PageRenderTime 20ms CodeModel.GetById 12ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/range/algorithm/rotate.hpp

http://hadesmem.googlecode.com/
C++ Header | 51 lines | 31 code | 6 blank | 14 comment | 0 complexity | 2505e2e8952cbf2f9185b65c78fd76b1 MD5 | raw file
 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
18namespace 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
28template<class ForwardRange>
29inline 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
38template<class ForwardRange>
39inline 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