Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:15

0001 // Boost.Range library
0002 //
0003 //  Copyright Neil Groves 2009. Use, modification and
0004 //  distribution is subject to the Boost Software License, Version
0005 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // For more information, see http://www.boost.org/libs/range/
0009 //
0010 #ifndef BOOST_RANGE_ALGORITHM_EXT_ERASE_HPP_INCLUDED
0011 #define BOOST_RANGE_ALGORITHM_EXT_ERASE_HPP_INCLUDED
0012 
0013 #include <boost/range/config.hpp>
0014 #include <boost/range/concepts.hpp>
0015 #include <boost/range/difference_type.hpp>
0016 #include <boost/range/iterator_range_core.hpp>
0017 #include <boost/range/begin.hpp>
0018 #include <boost/range/end.hpp>
0019 #include <boost/assert.hpp>
0020 
0021 namespace boost
0022 {
0023     namespace range
0024     {
0025 
0026 template< class Container >
0027 inline Container& erase( Container& on,
0028       iterator_range<BOOST_DEDUCED_TYPENAME Container::iterator> to_erase )
0029 {
0030     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
0031     on.erase( boost::begin(to_erase), boost::end(to_erase) );
0032     return on;
0033 }
0034 
0035 template< class Container, class T >
0036 inline Container& remove_erase( Container& on, const T& val )
0037 {
0038     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
0039     on.erase(
0040         std::remove(boost::begin(on), boost::end(on), val),
0041         boost::end(on));
0042     return on;
0043 }
0044 
0045 template< class Container, class Pred >
0046 inline Container& remove_erase_if( Container& on, Pred pred )
0047 {
0048     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
0049     on.erase(
0050         std::remove_if(boost::begin(on), boost::end(on), pred),
0051         boost::end(on));
0052     return on;
0053 }
0054 
0055 template< class Container >
0056 inline Container& unique_erase( Container& on)
0057 {
0058     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
0059     on.erase(
0060         std::unique(boost::begin(on), boost::end(on)),
0061         boost::end(on));
0062     return on;
0063 }
0064 
0065 template< class Container, class Pred >
0066 inline Container& unique_erase( Container& on, Pred pred )
0067 {
0068     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
0069     on.erase(
0070         std::unique(boost::begin(on), boost::end(on), pred),
0071         boost::end(on));
0072     return on;
0073 }
0074 
0075     } // namespace range
0076     using range::erase;
0077     using range::remove_erase;
0078     using range::remove_erase_if;
0079     using range::unique_erase;
0080 } // namespace boost
0081 
0082 #endif // include guard