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_ROTATE_COPY_HPP_INCLUDED 10 #define BOOST_RANGE_ALGORITHM_ROTATE_COPY_HPP_INCLUDED 11 12 #include <boost/concept_check.hpp> 13 #include <boost/range/begin.hpp> 14 #include <boost/range/end.hpp> 15 #include <boost/range/concepts.hpp> 16 #include <boost/range/iterator.hpp> 17 #include <algorithm> 18 19 namespace boost 20 { 21 namespace range 22 { 23 24 /// \brief template function rotate 25 /// 26 /// range-based version of the rotate std algorithm 27 /// 28 /// \pre Rng meets the requirements for a Forward range 29 template<typename ForwardRange, typename OutputIterator> rotate_copy(const ForwardRange & rng,BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type middle,OutputIterator target)30 inline OutputIterator rotate_copy( 31 const ForwardRange& rng, 32 BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type middle, 33 OutputIterator target 34 ) 35 { 36 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> )); 37 return std::rotate_copy(boost::begin(rng), middle, boost::end(rng), target); 38 } 39 40 } // namespace range 41 using range::rotate_copy; 42 } // namespace boost 43 44 #endif // include guard 45