...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Sequences / Intrinsic Metafunctions / erase |
template< typename Sequence , typename First , typename Last = unspecified > struct erase { 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>
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::type r;
Return type: | Extensible Sequence. |
---|---|
Precondition: | [first,last) is a valid range in s. |
Semantics: | r is a new sequence, concept-identical to s, of the following elements:
[begin |
Postcondition: | The relative order of the elements in r is the same as in s; size |
typedef erase::type r;
Return type: | Extensible Sequence. |
---|---|
Precondition: | pos is a dereferenceable iterator in s. |
Semantics: | Equivalent to typedef erase< s,pos,next |
For any Extensible Associative Sequence s, and iterator pos into s:
typedef erase::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 |
Postcondition: | size |
Sequence archetype | Complexity (the range form) |
---|---|
Extensible Associative Sequence | Amortized constant time. |
Extensible Sequence | Quadratic in the worst case, linear at best. |
typedef vector_cvalues; typedef find< values, integral_c >::type pos; typedef erase ::type result; BOOST_MPL_ASSERT_RELATION( size ::value, ==, 7 ); typedef find integral_c >::type iter; BOOST_MPL_ASSERT(( is_same< iter, end ::type > ));