Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/mpl/doc/refmanual/remove-if.html @ 29

Last change on this file since 29 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 10.0 KB
Line 
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4<!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost -->
5<!-- Software License, Version 1.0. (See accompanying -->
6<!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
7<head>
8<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9<meta name="generator" content="Docutils 0.3.6: http://docutils.sourceforge.net/" />
10<title>The MPL Reference Manual: remove_if</title>
11<link rel="stylesheet" href="../style.css" type="text/css" />
12</head>
13<body class="docframe refmanual">
14<table class="header"><tr class="header"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./remove.html" class="navigation-link">Prev</a>&nbsp;<a href="./unique.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./remove.html" class="navigation-link">Back</a>&nbsp;<a href="./unique.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./transformation-algorithms.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
15<td class="header-group page-location"><a href="../refmanual.html" class="navigation-link">Front Page</a> / <a href="./algorithms.html" class="navigation-link">Algorithms</a> / <a href="./transformation-algorithms.html" class="navigation-link">Transformation Algorithms</a> / <a href="./remove-if.html" class="navigation-link">remove_if</a></td>
16</tr></table><div class="header-separator"></div>
17<div class="section" id="remove-if">
18<h1><a class="toc-backref" href="./transformation-algorithms.html#id420" name="remove-if">remove_if</a></h1>
19<div class="section" id="transformation-remove-synopsis">
20<h3><a class="subsection-title" href="#synopsis" name="synopsis">Synopsis</a></h3>
21<pre class="literal-block">
22template&lt;
23      typename Sequence
24    , typename Pred
25    , typename In = <em>unspecified</em>
26    &gt;
27struct <a href="./remove-if.html" class="identifier">remove_if</a>
28{
29    typedef <em>unspecified</em> type;
30};
31</pre>
32</div>
33<div class="section" id="transformation-remove-description">
34<h3><a class="subsection-title" href="#description" name="description">Description</a></h3>
35<p>Returns a new sequence that contains all the elements from [<tt class="literal"><span class="pre"><a href="./begin.html" class="identifier">begin</a>&lt;Sequence&gt;::type</span></tt>, <tt class="literal"><span class="pre"><a href="./end.html" class="identifier">end</a>&lt;Sequence&gt;::type</span></tt>) range
36except those that satisfy the predicate <tt class="literal"><span class="pre">Pred</span></tt>.</p>
37<!-- Returns a copy of the original sequence with all elements satisfying the predicate
38``Pred`` removed. -->
39<p>[<em>Note:</em> This wording applies to a no-inserter version(s) of the algorithm. See the
40<cite>Expression semantics</cite> subsection for a precise specification of the algorithm's
41details in all cases — <em>end note</em>]</p>
42</div>
43<div class="section" id="transformation-remove-header">
44<h3><a class="subsection-title" href="#header" name="header">Header</a></h3>
45<pre class="literal-block">
46#include &lt;<a href="../../../../boost/mpl/remove_if.hpp" class="header">boost/mpl/remove_if.hpp</a>&gt;
47</pre>
48</div>
49<div class="section" id="transformation-remove-model-of">
50<h3><a class="subsection-title" href="#model-of" name="model-of">Model of</a></h3>
51<p><a class="reference" href="./reversible-algorithm.html">Reversible Algorithm</a></p>
52</div>
53<div class="section" id="transformation-remove-parameters">
54<h3><a class="subsection-title" href="#parameters" name="parameters">Parameters</a></h3>
55<table border="1" class="table">
56<colgroup>
57<col width="19%" />
58<col width="43%" />
59<col width="38%" />
60</colgroup>
61<thead valign="bottom">
62<tr><th>Parameter</th>
63<th>Requirement</th>
64<th>Description</th>
65</tr>
66</thead>
67<tbody valign="top">
68<tr><td><tt class="literal"><span class="pre">Sequence</span></tt></td>
69<td><a class="reference" href="./forward-sequence.html">Forward Sequence</a></td>
70<td>An original sequence.</td>
71</tr>
72<tr><td><tt class="literal"><span class="pre">Pred</span></tt></td>
73<td>Unary <a class="reference" href="./lambda-expression.html">Lambda Expression</a></td>
74<td>A removal condition.</td>
75</tr>
76<tr><td><tt class="literal"><span class="pre">In</span></tt></td>
77<td><a class="reference" href="./inserter.html">Inserter</a></td>
78<td>An inserter.</td>
79</tr>
80</tbody>
81</table>
82</div>
83<div class="section" id="transformation-remove-expression-semantics">
84<h3><a class="subsection-title" href="#expression-semantics" name="expression-semantics">Expression semantics</a></h3>
85<p>The semantics of an expression are defined only
86where they differ from, or are not defined in <a class="reference" href="./reversible-algorithm.html">Reversible Algorithm</a>.</p>
87<p>For any <a class="reference" href="./forward-sequence.html">Forward Sequence</a> <tt class="literal"><span class="pre">s</span></tt>, and an <a class="reference" href="./inserter.html">Inserter</a> <tt class="literal"><span class="pre">in</span></tt>, and an unary
88<a class="reference" href="./lambda-expression.html">Lambda Expression</a> <tt class="literal"><span class="pre">pred</span></tt>:</p>
89<pre class="literal-block">
90typedef <a href="./remove-if.html" class="identifier">remove_if</a>&lt;s,pred,in&gt;::type r;
91</pre>
92<table class="field-list" frame="void" rules="none">
93<col class="field-name" />
94<col class="field-body" />
95<tbody valign="top">
96<tr class="field"><th class="field-name">Return type:</th><td class="field-body">A type.</td>
97</tr>
98<tr class="field"><th class="field-name">Semantics:</th><td class="field-body"><p class="first">Equivalent to</p>
99<pre class="last literal-block">
100typedef <a href="./lambda.html" class="identifier">lambda</a>&lt;pred&gt;::type p;
101typedef <a href="./lambda.html" class="identifier">lambda</a>&lt;in::operation&gt;::type op;
102
103typedef <a href="./fold.html" class="identifier">fold</a>&lt;
104      s
105    , in::state
106    , <a href="./eval-if.html" class="identifier">eval_if</a>&lt;
107          <a href="./apply-wrap.html" class="identifier">apply_wrap</a><tt class="literal"><span class="pre">1</span></tt>&lt;p,_2&gt;
108        , <a href="./identity.html" class="identifier">identity</a>&lt;_1&gt;
109        , <a href="./apply-wrap.html" class="identifier">apply_wrap</a><tt class="literal"><span class="pre">2</span></tt>&lt;op,_1,_2&gt;
110        &gt;
111    &gt;::type r;
112</pre>
113</td>
114</tr>
115</tbody>
116</table>
117</div>
118<div class="section" id="transformation-remove-complexity">
119<h3><a class="subsection-title" href="#complexity" name="complexity">Complexity</a></h3>
120<p>Linear. Performs exactly <tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a>&lt;s&gt;::value</span></tt> applications of <tt class="literal"><span class="pre">pred</span></tt>, and at
121most <tt class="literal"><span class="pre"><a href="./size.html" class="identifier">size</a>&lt;s&gt;::value</span></tt> insertions.</p>
122</div>
123<div class="section" id="transformation-remove-example">
124<h3><a class="subsection-title" href="#example" name="example">Example</a></h3>
125<pre class="literal-block">
126typedef <a href="./vector-c.html" class="identifier">vector_c</a>&lt;int,1,4,5,2,7,5,3,5&gt;::type numbers;
127typedef <a href="./remove-if.html" class="identifier">remove_if</a>&lt; numbers, <a href="./greater.html" class="identifier">greater</a>&lt;_,<a href="./int.html" class="identifier">int_</a>&lt;4&gt; &gt; &gt;::type result;
128
129<a href="./assert.html" class="identifier">BOOST_MPL_ASSERT</a>(( <a href="./equal.html" class="identifier">equal</a>&lt; result,<a href="./vector-c.html" class="identifier">vector_c</a>&lt;int,1,4,2,3&gt;,<a href="./equal-to.html" class="identifier">equal_to</a>&lt;_,_&gt; > ));
130</pre>
131</div>
132<div class="section" id="transformation-remove-see-also">
133<h3><a class="subsection-title" href="#see-also" name="see-also">See also</a></h3>
134<p><a class="reference" href="./transformation-algorithms.html">Transformation Algorithms</a>, <a class="reference" href="./reversible-algorithm.html">Reversible Algorithm</a>, <a class="refentry reference" href="./reverse-remove-if.html"><tt class="refentry literal"><span class="pre">reverse_remove_if</span></tt></a>, <a class="refentry reference" href="./remove.html"><tt class="refentry literal"><span class="pre">remove</span></tt></a>, <a class="refentry reference" href="./copy-if.html"><tt class="refentry literal"><span class="pre">copy_if</span></tt></a>, <a class="refentry reference" href="./replace-if.html"><tt class="refentry literal"><span class="pre">replace_if</span></tt></a></p>
135<!-- modtime: November 10, 2004 04:33:13 +0000 -->
136<!-- Algorithms/Transformation Algorithms//unique |80 -->
137</div>
138</div>
139
140<div class="footer-separator"></div>
141<table class="footer"><tr class="footer"><td class="header-group navigation-bar"><span class="navigation-group"><a href="./remove.html" class="navigation-link">Prev</a>&nbsp;<a href="./unique.html" class="navigation-link">Next</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./remove.html" class="navigation-link">Back</a>&nbsp;<a href="./unique.html" class="navigation-link">Along</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./transformation-algorithms.html" class="navigation-link">Up</a>&nbsp;<a href="../refmanual.html" class="navigation-link">Home</a></span><span class="navigation-group-separator">&nbsp;|&nbsp;</span><span class="navigation-group"><a href="./refmanual_toc.html" class="navigation-link">Full TOC</a></span></td>
142</tr></table></body>
143</html>
Note: See TracBrowser for help on using the repository browser.