3 // Copyright Neil Groves 2009. Use, modification and
4 // distribution is subject to the Boost Software License, Version
5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
8 // For more information, see http://www.boost.org/libs/range/
10 #ifndef BOOST_RANGE_ALGORITHM_EXT_ERASE_HPP_INCLUDED
11 #define BOOST_RANGE_ALGORITHM_EXT_ERASE_HPP_INCLUDED
13 #include <boost/range/config.hpp>
14 #include <boost/range/concepts.hpp>
15 #include <boost/range/difference_type.hpp>
16 #include <boost/range/iterator_range_core.hpp>
17 #include <boost/range/begin.hpp>
18 #include <boost/range/end.hpp>
19 #include <boost/assert.hpp>
26 template< class Container >
27 inline Container& erase( Container& on,
28 iterator_range<BOOST_DEDUCED_TYPENAME Container::iterator> to_erase )
30 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
31 on.erase( boost::begin(to_erase), boost::end(to_erase) );
35 template< class Container, class T >
36 inline Container& remove_erase( Container& on, const T& val )
38 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
40 std::remove(boost::begin(on), boost::end(on), val),
45 template< class Container, class Pred >
46 inline Container& remove_erase_if( Container& on, Pred pred )
48 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
50 std::remove_if(boost::begin(on), boost::end(on), pred),
57 using range::remove_erase;
58 using range::remove_erase_if;
61 #endif // include guard