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