3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/erase.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Intrinsic Metafunctions / erase |
template<
typename Sequence
, typename First
, typename Last =_unspecified_>
struct[erase](./erase.html){
typedef_unspecified_type;
};
erase performs a removal of one or more adjacent elements in the sequence starting from an arbitrary position.
#include <[boost/mpl/erase.hpp](../../../../boost/mpl/erase.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| Sequence | Extensible Sequence or Extensible Associative Sequence | A sequence to erase from. |
| First | Forward Iterator | An iterator to the beginning of the range to be erased. |
| Last | Forward Iterator | An iterator past-the-end of the range to be erased. |
For any Extensible Sequence s, and iterators pos, first and last into s:
typedef[erase](./erase.html)<s,first,last>::type r;
| Return type: |
| | Precondition: |
[first,last) is a valid range in s.
| | Semantics: |
r is a new sequence, concept-identical to s, of the following elements: [begin<s>::type, pos), [last, end<s>::type).
| | Postcondition: |
The relative order of the elements in r is the same as in s;
[size](./size.html)<r>::value ==[size](./size.html)<s>::value -[distance](./distance.html)<first,last>::value
|
typedef[erase](./erase.html)<s,pos>::type r;
| Return type: |
| | Precondition: |
pos is a dereferenceable iterator in s.
| | Semantics: |
Equivalent to
typedef[erase](./erase.html)< s,pos,[next](./next.html)<pos>::type >::type r;
|
For any Extensible Associative Sequence s, and iterator pos into s:
typedef[erase](./erase.html)<s,pos>::type r;
| Return type: | Extensible Sequence. | | Precondition: | pos is a dereferenceable iterator to s. | | Semantics: | Erases the element at a specific position pos; equivalent to erase_key<s, deref<pos>::type >::type. | | Postcondition: | size<r>::value == size<s>::value - 1. |
| Sequence archetype | Complexity (the range form) |
|---|---|
| Extensible Associative Sequence | Amortized constant time. |
| Extensible Sequence | Quadratic in the worst case, linear at best. |
typedef[vector\_c](./vector-c.html)<int,1,0,5,1,7,5,0,5> values;
typedef[find](./find.html)< values,[integral\_c](./integral-c.html)<int,7> >::type pos;
typedef[erase](./erase.html)<values,pos>::type result;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<result>::value, ==, 7 );
typedef[find](./find.html)<result,[integral\_c](./integral-c.html)<int,7> >::type iter;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same< iter,[end](./end.html)<result>::type > ));
Extensible Sequence, Extensible Associative Sequence, erase_key, pop_front, pop_back, insert
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |