1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>erase</title> 5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../../../index.html" title="Chapter 1. Fusion 2.2"> 8<link rel="up" href="../functions.html" title="Functions"> 9<link rel="prev" href="clear.html" title="clear"> 10<link rel="next" href="erase_key.html" title="erase_key"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="clear.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="erase_key.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="fusion.algorithm.transformation.functions.erase"></a><a class="link" href="erase.html" title="erase">erase</a> 28</h5></div></div></div> 29<h6> 30<a name="fusion.algorithm.transformation.functions.erase.h0"></a> 31 <span class="phrase"><a name="fusion.algorithm.transformation.functions.erase.description"></a></span><a class="link" href="erase.html#fusion.algorithm.transformation.functions.erase.description">Description</a> 32 </h6> 33<p> 34 Returns a new sequence, containing all the elements of the original except 35 those at a specified iterator, or between two iterators. 36 </p> 37<h6> 38<a name="fusion.algorithm.transformation.functions.erase.h1"></a> 39 <span class="phrase"><a name="fusion.algorithm.transformation.functions.erase.synopsis"></a></span><a class="link" href="erase.html#fusion.algorithm.transformation.functions.erase.synopsis">Synopsis</a> 40 </h6> 41<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 42 <span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">,</span> 43 <span class="keyword">typename</span> <span class="identifier">First</span> 44 <span class="special">></span> 45<span class="keyword">typename</span> <a class="link" href="../metafunctions/erase.html" title="erase"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">erase</span></code></a><span class="special"><</span><span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">First</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">erase</span><span class="special">(</span> 46 <span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">seq</span><span class="special">,</span> <span class="identifier">First</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">it1</span><span class="special">);</span> 47 48<span class="keyword">template</span><span class="special"><</span> 49 <span class="keyword">typename</span> <span class="identifier">Sequence</span><span class="special">,</span> 50 <span class="keyword">typename</span> <span class="identifier">First</span><span class="special">,</span> 51 <span class="keyword">typename</span> <span class="identifier">Last</span> 52 <span class="special">></span> 53<span class="keyword">typename</span> <a class="link" href="../metafunctions/erase.html" title="erase"><code class="computeroutput"><span class="identifier">result_of</span><span class="special">::</span><span class="identifier">erase</span></code></a><span class="special"><</span><span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">,</span> <span class="identifier">First</span><span class="special">,</span> <span class="identifier">Last</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">erase</span><span class="special">(</span> 54 <span class="identifier">Sequence</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">seq</span><span class="special">,</span> <span class="identifier">First</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">it1</span><span class="special">,</span> <span class="identifier">Last</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">it2</span><span class="special">);</span> 55</pre> 56<div class="table"> 57<a name="fusion.algorithm.transformation.functions.erase.t0"></a><p class="title"><b>Table 1.76. Parameters</b></p> 58<div class="table-contents"><table class="table" summary="Parameters"> 59<colgroup> 60<col> 61<col> 62<col> 63</colgroup> 64<thead><tr> 65<th> 66 <p> 67 Parameters 68 </p> 69 </th> 70<th> 71 <p> 72 Requirement 73 </p> 74 </th> 75<th> 76 <p> 77 Description 78 </p> 79 </th> 80</tr></thead> 81<tbody> 82<tr> 83<td> 84 <p> 85 <code class="computeroutput"><span class="identifier">seq</span></code> 86 </p> 87 </td> 88<td> 89 <p> 90 A model of <a class="link" href="../../../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward 91 Sequence</a> 92 </p> 93 </td> 94<td> 95 <p> 96 Operation's argument 97 </p> 98 </td> 99</tr> 100<tr> 101<td> 102 <p> 103 <code class="computeroutput"><span class="identifier">it1</span></code> 104 </p> 105 </td> 106<td> 107 <p> 108 A model of <a class="link" href="../../../iterator/concepts/forward_iterator.html" title="Forward Iterator">Forward 109 Iterator</a> 110 </p> 111 </td> 112<td> 113 <p> 114 Iterator into <code class="computeroutput"><span class="identifier">seq</span></code> 115 </p> 116 </td> 117</tr> 118<tr> 119<td> 120 <p> 121 <code class="computeroutput"><span class="identifier">it2</span></code> 122 </p> 123 </td> 124<td> 125 <p> 126 A model of <a class="link" href="../../../iterator/concepts/forward_iterator.html" title="Forward Iterator">Forward 127 Iterator</a> 128 </p> 129 </td> 130<td> 131 <p> 132 Iterator into <code class="computeroutput"><span class="identifier">seq</span></code> 133 after <code class="computeroutput"><span class="identifier">it1</span></code> 134 </p> 135 </td> 136</tr> 137</tbody> 138</table></div> 139</div> 140<br class="table-break"><h6> 141<a name="fusion.algorithm.transformation.functions.erase.h2"></a> 142 <span class="phrase"><a name="fusion.algorithm.transformation.functions.erase.expression_semantics"></a></span><a class="link" href="erase.html#fusion.algorithm.transformation.functions.erase.expression_semantics">Expression 143 Semantics</a> 144 </h6> 145<pre class="programlisting"><a class="link" href="erase.html" title="erase"><code class="computeroutput"><span class="identifier">erase</span></code></a><span class="special">(</span><span class="identifier">seq</span><span class="special">,</span> <span class="identifier">pos</span><span class="special">);</span> 146</pre> 147<p> 148 <span class="bold"><strong>Return type</strong></span>: 149 </p> 150<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 151<li class="listitem"> 152 A model of <a class="link" href="../../../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward 153 Sequence</a>. 154 </li> 155<li class="listitem"> 156 A model of <a class="link" href="../../../sequence/concepts/associative_sequence.html" title="Associative Sequence">Associative 157 Sequence</a> if <code class="computeroutput"><span class="identifier">seq</span></code> 158 implements the <a class="link" href="../../../sequence/concepts/associative_sequence.html" title="Associative Sequence">Associative 159 Sequence</a> model. 160 </li> 161</ul></div> 162<p> 163 <span class="bold"><strong>Semantics</strong></span>: Returns a new sequence, containing 164 all the elements of <code class="computeroutput"><span class="identifier">seq</span></code> 165 except the element at <code class="computeroutput"><span class="identifier">pos</span></code>. 166 </p> 167<pre class="programlisting"><a class="link" href="erase.html" title="erase"><code class="computeroutput"><span class="identifier">erase</span></code></a><span class="special">(</span><span class="identifier">seq</span><span class="special">,</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">);</span> 168</pre> 169<p> 170 <span class="bold"><strong>Return type</strong></span>: 171 </p> 172<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 173<li class="listitem"> 174 A model of <a class="link" href="../../../sequence/concepts/forward_sequence.html" title="Forward Sequence">Forward 175 Sequence</a>. 176 </li> 177<li class="listitem"> 178 A model of <a class="link" href="../../../sequence/concepts/associative_sequence.html" title="Associative Sequence">Associative 179 Sequence</a> if <code class="computeroutput"><span class="identifier">seq</span></code> 180 implements the <a class="link" href="../../../sequence/concepts/associative_sequence.html" title="Associative Sequence">Associative 181 Sequence</a> model. 182 </li> 183</ul></div> 184<p> 185 <span class="bold"><strong>Semantics</strong></span>: Returns a new sequence, with 186 all the elements of <code class="computeroutput"><span class="identifier">seq</span></code>, 187 in their original order, except those in the range [<code class="computeroutput"><span class="identifier">first</span></code>,<code class="computeroutput"><span class="identifier">last</span></code>). 188 </p> 189<h6> 190<a name="fusion.algorithm.transformation.functions.erase.h3"></a> 191 <span class="phrase"><a name="fusion.algorithm.transformation.functions.erase.complexity"></a></span><a class="link" href="erase.html#fusion.algorithm.transformation.functions.erase.complexity">Complexity</a> 192 </h6> 193<p> 194 Constant. Returns a view which is lazily evaluated. 195 </p> 196<h6> 197<a name="fusion.algorithm.transformation.functions.erase.h4"></a> 198 <span class="phrase"><a name="fusion.algorithm.transformation.functions.erase.header"></a></span><a class="link" href="erase.html#fusion.algorithm.transformation.functions.erase.header">Header</a> 199 </h6> 200<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">transformation</span><span class="special">/</span><span class="identifier">erase</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 201<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">erase</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 202</pre> 203<h6> 204<a name="fusion.algorithm.transformation.functions.erase.h5"></a> 205 <span class="phrase"><a name="fusion.algorithm.transformation.functions.erase.example"></a></span><a class="link" href="erase.html#fusion.algorithm.transformation.functions.erase.example">Example</a> 206 </h6> 207<pre class="programlisting"><span class="keyword">const</span> <a class="link" href="../../../container/vector.html" title="vector"><code class="computeroutput"><span class="identifier">vector</span></code></a><span class="special"><</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">double</span><span class="special">,</span> <span class="keyword">char</span><span class="special">></span> <span class="identifier">vec</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2.0</span><span class="special">,</span> <span class="char">'c'</span><span class="special">);</span> 208<span class="identifier">assert</span><span class="special">(</span><a class="link" href="erase.html" title="erase"><code class="computeroutput"><span class="identifier">erase</span></code></a><span class="special">(</span><span class="identifier">vec</span><span class="special">,</span> <a class="link" href="../../../iterator/functions/next.html" title="next"><code class="computeroutput"><span class="identifier">next</span></code></a><span class="special">(</span><a class="link" href="../../../sequence/intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">vec</span><span class="special">)))</span> <span class="special">==</span> <a class="link" href="../../../container/generation/functions/make_vector.html" title="make_vector"><code class="computeroutput"><span class="identifier">make_vector</span></code></a><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="char">'c'</span><span class="special">));</span> 209<span class="identifier">assert</span><span class="special">(</span><a class="link" href="erase.html" title="erase"><code class="computeroutput"><span class="identifier">erase</span></code></a><span class="special">(</span><span class="identifier">vec</span><span class="special">,</span> <a class="link" href="../../../iterator/functions/next.html" title="next"><code class="computeroutput"><span class="identifier">next</span></code></a><span class="special">(</span><a class="link" href="../../../sequence/intrinsic/functions/begin.html" title="begin"><code class="computeroutput"><span class="identifier">begin</span></code></a><span class="special">(</span><span class="identifier">vec</span><span class="special">)),</span> <a class="link" href="../../../sequence/intrinsic/functions/end.html" title="end"><code class="computeroutput"><span class="identifier">end</span></code></a><span class="special">(</span><span class="identifier">vec</span><span class="special">))</span> <span class="special">==</span> <a class="link" href="../../../container/generation/functions/make_vector.html" title="make_vector"><code class="computeroutput"><span class="identifier">make_vector</span></code></a><span class="special">(</span><span class="number">1</span><span class="special">));</span> 210</pre> 211</div> 212<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 213<td align="left"></td> 214<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman, 215 Dan Marsden, Tobias Schwinger<p> 216 Distributed under the Boost Software License, Version 1.0. (See accompanying 217 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 218 </p> 219</div></td> 220</tr></table> 221<hr> 222<div class="spirit-nav"> 223<a accesskey="p" href="clear.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../functions.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="erase_key.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 224</div> 225</body> 226</html> 227