...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Returns a new sequence, containing all the elements of the original except those at a specified iterator, or between two iterators.
template< typename Sequence, typename First > typenameresult_of::erase
<Sequence const, First>::type erase( Sequence const& seq, First const& it1); template< typename Sequence, typename First, typename Last > typenameresult_of::erase
<Sequence const, First, Last>::type erase( Sequence const& seq, First const& it1, Last const& it2);
Table 1.76. Parameters
Parameters |
Requirement |
Description |
---|---|---|
|
A model of Forward Sequence |
Operation's argument |
|
A model of Forward Iterator |
Iterator into |
|
A model of Forward Iterator |
Iterator into |
erase
(seq, pos);
Return type:
seq
implements the Associative
Sequence model.
Semantics: Returns a new sequence, containing
all the elements of seq
except the element at pos
.
erase
(seq, first, last);
Return type:
seq
implements the Associative
Sequence model.
Semantics: Returns a new sequence, with
all the elements of seq
,
in their original order, except those in the range [first
,last
).
Constant. Returns a view which is lazily evaluated.
#include <boost/fusion/algorithm/transformation/erase.hpp> #include <boost/fusion/include/erase.hpp>
constvector
<int, double, char> vec(1, 2.0, 'c'); assert(erase
(vec,next
(begin
(vec))) ==make_vector
(1, 'c')); assert(erase
(vec,next
(begin
(vec)),end
(vec)) ==make_vector
(1));