reverse_copy.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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_REVERSE_COPY_HPP_INCLUDED
  10. #define BOOST_RANGE_ALGORITHM_REVERSE_COPY_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 <boost/iterator/iterator_concepts.hpp>
  16. #include <algorithm>
  17. namespace boost
  18. {
  19. namespace range
  20. {
  21. /// \brief template function reverse_copy
  22. ///
  23. /// range-based version of the reverse_copy std algorithm
  24. ///
  25. /// \pre BidirectionalRange is a model of the BidirectionalRangeConcept
  26. template<class BidirectionalRange, class OutputIterator>
  27. inline OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out)
  28. {
  29. BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
  30. return std::reverse_copy(boost::begin(rng), boost::end(rng), out);
  31. }
  32. } // namespace range
  33. using range::reverse_copy;
  34. } // namespace boost
  35. #endif // include guard