remove_copy_if.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright Neil Groves 2009. Use, modification and
  2. // distribution is subject to the Boost Software License, Version
  3. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. //
  6. //
  7. // For more information, see http://www.boost.org/libs/range/
  8. //
  9. #ifndef BOOST_RANGE_ALGORITHM_REMOVE_COPY_IF_HPP_INCLUDED
  10. #define BOOST_RANGE_ALGORITHM_REMOVE_COPY_IF_HPP_INCLUDED
  11. #include <boost/concept_check.hpp>
  12. #include <boost/range/begin.hpp>
  13. #include <boost/range/end.hpp>
  14. #include <boost/range/concepts.hpp>
  15. #include <algorithm>
  16. namespace boost
  17. {
  18. /// \brief template function remove_copy_if
  19. ///
  20. /// range-based version of the remove_copy_if std algorithm
  21. ///
  22. /// \pre SinglePassRange is a model of the SinglePassRangeConcept
  23. /// \pre OutputIterator is a model of the OutputIteratorConcept
  24. /// \pre Predicate is a model of the PredicateConcept
  25. /// \pre InputIterator's value type is convertible to Predicate's argument type
  26. /// \pre out_it is not an iterator in the range rng
  27. template< class SinglePassRange, class OutputIterator, class Predicate >
  28. inline OutputIterator
  29. remove_copy_if(const SinglePassRange& rng, OutputIterator out_it, Predicate pred)
  30. {
  31. BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
  32. return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred);
  33. }
  34. }
  35. #endif // include guard