• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2    Copyright 2010 Neil Groves
3    Distributed under the Boost Software License, Version 1.0.
4    (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5/]
6[section:rotate rotate]
7
8[heading Prototype]
9
10``
11template<class ForwardRange>
12ForwardRange& rotate(ForwardRange& rng,
13                     typename range_iterator<ForwardRange>::type middle);
14
15template<class ForwardRange>
16const ForwardRange& rotate(const ForwardRange& rng,
17                           typename range_iterator<const ForwardRange>::type middle);
18``
19
20[heading Description]
21
22`rotate` rotates the elements in a range. It exchanges the two ranges `[begin(rng), middle)` and `[middle, end(rng))`. Returns a reference to `rng`.
23
24[heading Definition]
25
26Defined in the header file `boost/range/algorithm/rotate.hpp`
27
28[heading Requirements]
29
30* `ForwardRange` is a model of the __forward_range__ Concept.
31* `ForwardRange` is mutable.
32
33[heading Precondition:]
34
35* `[begin(rng), middle)` is a valid range.
36* `[middle, end(rng))` is a valid range.
37
38[heading Complexity]
39
40Linear. At most `distance(rng)` swaps are performed.
41
42[endsect]
43
44
45