annotate DEPENDENCIES/generic/include/boost/range/algorithm_ext/erase.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Range library
Chris@16 2 //
Chris@16 3 // Copyright Neil Groves 2009. Use, modification and
Chris@16 4 // distribution is subject to the Boost Software License, Version
Chris@16 5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // For more information, see http://www.boost.org/libs/range/
Chris@16 9 //
Chris@16 10 #ifndef BOOST_RANGE_ALGORITHM_EXT_ERASE_HPP_INCLUDED
Chris@16 11 #define BOOST_RANGE_ALGORITHM_EXT_ERASE_HPP_INCLUDED
Chris@16 12
Chris@16 13 #include <boost/range/config.hpp>
Chris@16 14 #include <boost/range/concepts.hpp>
Chris@16 15 #include <boost/range/difference_type.hpp>
Chris@16 16 #include <boost/range/iterator_range_core.hpp>
Chris@16 17 #include <boost/range/begin.hpp>
Chris@16 18 #include <boost/range/end.hpp>
Chris@16 19 #include <boost/assert.hpp>
Chris@16 20
Chris@16 21 namespace boost
Chris@16 22 {
Chris@16 23 namespace range
Chris@16 24 {
Chris@16 25
Chris@16 26 template< class Container >
Chris@16 27 inline Container& erase( Container& on,
Chris@16 28 iterator_range<BOOST_DEDUCED_TYPENAME Container::iterator> to_erase )
Chris@16 29 {
Chris@16 30 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
Chris@16 31 on.erase( boost::begin(to_erase), boost::end(to_erase) );
Chris@16 32 return on;
Chris@16 33 }
Chris@16 34
Chris@16 35 template< class Container, class T >
Chris@16 36 inline Container& remove_erase( Container& on, const T& val )
Chris@16 37 {
Chris@16 38 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
Chris@16 39 on.erase(
Chris@16 40 std::remove(boost::begin(on), boost::end(on), val),
Chris@16 41 boost::end(on));
Chris@16 42 return on;
Chris@16 43 }
Chris@16 44
Chris@16 45 template< class Container, class Pred >
Chris@16 46 inline Container& remove_erase_if( Container& on, Pred pred )
Chris@16 47 {
Chris@16 48 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<Container> ));
Chris@16 49 on.erase(
Chris@16 50 std::remove_if(boost::begin(on), boost::end(on), pred),
Chris@16 51 boost::end(on));
Chris@16 52 return on;
Chris@16 53 }
Chris@16 54
Chris@16 55 } // namespace range
Chris@16 56 using range::erase;
Chris@16 57 using range::remove_erase;
Chris@16 58 using range::remove_erase_if;
Chris@16 59 } // namespace boost
Chris@16 60
Chris@16 61 #endif // include guard