source:
vendors/XIOS/current/extern/boost/include/boost/range/algorithm/rotate.hpp
@
3408
Last change on this file since 3408 was 3408, checked in by rblod, 12 years ago | |
---|---|
|
|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[3408] | 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_HPP_INCLUDED | |
10 | #define BOOST_RANGE_ALGORITHM_ROTATE_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 <algorithm> | |
17 | ||
18 | namespace boost | |
19 | { | |
20 | namespace range | |
21 | { | |
22 | ||
23 | /// \brief template function rotate | |
24 | /// | |
25 | /// range-based version of the rotate std algorithm | |
26 | /// | |
27 | /// \pre Rng meets the requirements for a Forward range | |
28 | template<class ForwardRange> | |
29 | inline ForwardRange& rotate(ForwardRange& rng, | |
30 | BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type middle) | |
31 | { | |
32 | BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> )); | |
33 | std::rotate(boost::begin(rng), middle, boost::end(rng)); | |
34 | return rng; | |
35 | } | |
36 | ||
37 | /// \overload | |
38 | template<class ForwardRange> | |
39 | inline const ForwardRange& rotate(const ForwardRange& rng, | |
40 | BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type middle) | |
41 | { | |
42 | BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> )); | |
43 | std::rotate(boost::begin(rng), middle, boost::end(rng)); | |
44 | return rng; | |
45 | } | |
46 | ||
47 | } // namespace range | |
48 | using range::rotate; | |
49 | } // namespace boost | |
50 | ||
51 | #endif // include guard |
Note: See TracBrowser
for help on using the repository browser.