1 .. Sequences/Intrinsic Metafunctions//erase
14 , typename Last = |unspecified|
18 typedef |unspecified| type;
26 ``erase`` performs a removal of one or more adjacent elements in the sequence
27 starting from an arbitrary position.
34 #include <boost/mpl/erase.hpp>
40 |Tag Dispatched Metafunction|
46 +---------------+-----------------------------------+-----------------------------------------------+
47 | Parameter | Requirement | Description |
48 +===============+===================================+===============================================+
49 | ``Sequence`` | |Extensible Sequence| or | A sequence to erase from. |
50 | | |Extensible Associative Sequence| | |
51 +---------------+-----------------------------------+-----------------------------------------------+
52 | ``First`` | |Forward Iterator| | An iterator to the beginning of the range to |
54 +---------------+-----------------------------------+-----------------------------------------------+
55 | ``Last`` | |Forward Iterator| | An iterator past-the-end of the range to be |
57 +---------------+-----------------------------------+-----------------------------------------------+
64 :class: expression-semantics
66 For any |Extensible Sequence| ``s``, and iterators ``pos``, ``first`` and ``last`` into ``s``:
71 typedef erase<s,first,last>::type r;
74 |Extensible Sequence|.
77 ``[first,last)`` is a valid range in ``s``.
80 ``r`` is a new sequence, |concept-identical| to ``s``, of the following elements:
81 [``begin<s>::type``, ``pos``), [``last``, ``end<s>::type``).
84 The relative order of the elements in ``r`` is the same as in ``s``;
88 size<r>::value == size<s>::value - distance<first,last>::value
91 .. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95 typedef erase<s,pos>::type r;
98 |Extensible Sequence|.
101 ``pos`` is a dereferenceable iterator in ``s``.
108 typedef erase< s,pos,next<pos>::type >::type r;
113 :class: expression-semantics
115 For any |Extensible Associative Sequence| ``s``, and iterator ``pos`` into ``s``:
119 typedef erase<s,pos>::type r;
122 |Extensible Sequence|.
125 ``pos`` is a dereferenceable iterator to ``s``.
128 Erases the element at a specific position ``pos``; equivalent to
129 ``erase_key<s, deref<pos>::type >::type``.
132 ``size<r>::value == size<s>::value - 1``.
138 +---------------------------------------+-----------------------------------------------+
139 | Sequence archetype | Complexity (the range form) |
140 +=======================================+===============================================+
141 | |Extensible Associative Sequence| | Amortized constant time. |
142 +---------------------------------------+-----------------------------------------------+
143 | |Extensible Sequence| | Quadratic in the worst case, linear at best. |
144 +---------------------------------------+-----------------------------------------------+
152 typedef vector_c<int,1,0,5,1,7,5,0,5> values;
153 typedef find< values, integral_c<int,7> >::type pos;
154 typedef erase<values,pos>::type result;
156 BOOST_MPL_ASSERT_RELATION( size<result>::value, ==, 7 );
158 typedef find<result, integral_c<int,7> >::type iter;
159 BOOST_MPL_ASSERT(( is_same< iter, end<result>::type > ));
165 |Extensible Sequence|, |Extensible Associative Sequence|, |erase_key|, |pop_front|, |pop_back|, |insert|
168 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
169 Distributed under the Boost Software License, Version 1.0. (See accompanying
170 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)