copy_backward.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_COPY_BACKWARD_HPP_INCLUDED
  10. #define BOOST_RANGE_ALGORITHM_COPY_BACKWARD_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. namespace range
  19. {
  20. /// \brief template function copy_backward
  21. ///
  22. /// range-based version of the copy_backwards std algorithm
  23. ///
  24. /// \pre BidirectionalRange is a model of the BidirectionalRangeConcept
  25. /// \pre BidirectionalTraversalWriteableIterator is a model of the BidirectionalIteratorConcept
  26. /// \pre BidirectionalTraversalWriteableIterator is a model of the WriteableIteratorConcept
  27. template< class BidirectionalRange, class BidirectionalTraversalWriteableIterator >
  28. inline BidirectionalTraversalWriteableIterator
  29. copy_backward(const BidirectionalRange& rng,
  30. BidirectionalTraversalWriteableIterator out)
  31. {
  32. BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
  33. return std::copy_backward(boost::begin(rng), boost::end(rng), out);
  34. }
  35. } // namespace range
  36. using range::copy_backward;
  37. } // namespace boost
  38. #endif // include guard