| Home | Libraries | People | FAQ | More

##### erase

###### Description

Returns a new sequence, containing all the elements of the original except those at a specified iterator, or between two iterators.

###### Synposis

    template<
        typename Sequence,
        typename First
        >
    typename result_of::erase<Sequence const, First>::type erase(
        Sequence const& seq, First const& it1);

    template<
        typename Sequence,
        typename First,
        typename Last
        >
    typename result_of::erase<Sequence const, First, Last>::type erase(
        Sequence const& seq, First const& it1, Last const& it2);

Table 1.73. Parameters

Parameters | Requirement | Description
--- | --- | ---
`seq` | A model of Forward Sequence | Operation's argument
`it1` | A model of Forward Iterator | Iterator into `seq`
`it2` | A model of Forward Iterator | Iterator into `seq` after `it1`

###### Expression Semantics

    erase(seq, pos);

Return type:

- A model of Forward Sequence.
- A model of Associative Sequence if `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:

- A model of Forward Sequence.
- A model of Associative Sequence if `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`).

###### Complexity

Constant. Returns a view which is lazily evaluated.

###### Header

    #include <boost/fusion/algorithm/transformation/erase.hpp>
    #include <boost/fusion/include/erase.hpp>

###### Example

    const vector<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));