Chris@16
|
1 // Copyright Neil Groves 2009. Use, modification and
|
Chris@16
|
2 // distribution is subject to the Boost Software License, Version
|
Chris@16
|
3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5 //
|
Chris@16
|
6 //
|
Chris@16
|
7 // For more information, see http://www.boost.org/libs/range/
|
Chris@16
|
8 //
|
Chris@16
|
9 #ifndef BOOST_RANGE_ALGORITHM_ROTATE_COPY_HPP_INCLUDED
|
Chris@16
|
10 #define BOOST_RANGE_ALGORITHM_ROTATE_COPY_HPP_INCLUDED
|
Chris@16
|
11
|
Chris@16
|
12 #include <boost/concept_check.hpp>
|
Chris@16
|
13 #include <boost/range/begin.hpp>
|
Chris@16
|
14 #include <boost/range/end.hpp>
|
Chris@16
|
15 #include <boost/range/concepts.hpp>
|
Chris@16
|
16 #include <boost/range/iterator.hpp>
|
Chris@16
|
17 #include <algorithm>
|
Chris@16
|
18
|
Chris@16
|
19 namespace boost
|
Chris@16
|
20 {
|
Chris@16
|
21 namespace range
|
Chris@16
|
22 {
|
Chris@16
|
23
|
Chris@16
|
24 /// \brief template function rotate
|
Chris@16
|
25 ///
|
Chris@16
|
26 /// range-based version of the rotate std algorithm
|
Chris@16
|
27 ///
|
Chris@16
|
28 /// \pre Rng meets the requirements for a Forward range
|
Chris@16
|
29 template<typename ForwardRange, typename OutputIterator>
|
Chris@16
|
30 inline OutputIterator rotate_copy(
|
Chris@16
|
31 const ForwardRange& rng,
|
Chris@16
|
32 BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type middle,
|
Chris@16
|
33 OutputIterator target
|
Chris@16
|
34 )
|
Chris@16
|
35 {
|
Chris@16
|
36 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
|
Chris@16
|
37 return std::rotate_copy(boost::begin(rng), middle, boost::end(rng), target);
|
Chris@16
|
38 }
|
Chris@16
|
39
|
Chris@16
|
40 } // namespace range
|
Chris@16
|
41 using range::rotate_copy;
|
Chris@16
|
42 } // namespace boost
|
Chris@16
|
43
|
Chris@16
|
44 #endif // include guard
|