boost::range::erase

References

Headers

boost::range::erase is available by including any of the following headers:

  • boost/range/algorithm_ext/erase.hpp or
  • boost/range/algorithm_ext.hpp

Examples

erase.cpp

#include <iostream>
#include <vector>
#include <boost/range/algorithm.hpp>
#include <boost/range/algorithm_ext.hpp>

int main() {
    std::vector<int> vec = {1, 2, 3, 4, 5};

    // Erase an arbitrary range from a vector.
    boost::range::erase(vec, boost::make_iterator_range(vec.begin() + 1,
                                                        vec.begin() + 4));

    boost::range::copy(vec, std::ostream_iterator<int>(std::cout, " "));
    std::cout << std::endl;
    return 0;
}

Output:

1 5

 

Boost Range for Humans

This reference is part of Boost Range for Humans. Click the link to the overview.