From Jason Turner

[alg.rotate]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpvnx2h6ej/{from.md → to.md} +23 -14
tmp/tmpvnx2h6ej/{from.md → to.md} RENAMED
@@ -1,44 +1,53 @@
1
  ### Rotate <a id="alg.rotate">[[alg.rotate]]</a>
2
 
3
  ``` cpp
4
  template<class ForwardIterator>
5
- ForwardIterator rotate(ForwardIterator first, ForwardIterator middle,
6
- ForwardIterator last);
 
 
 
 
7
  ```
8
 
 
 
 
 
 
 
 
9
  *Effects:* For each non-negative integer `i < (last - first)`, places
10
  the element from the position `first + i` into position
11
  `first + (i + (last - middle)) % (last - first)`.
12
 
13
  *Returns:* `first + (last - middle)`.
14
 
15
  *Remarks:* This is a left rotate.
16
 
17
- *Requires:* \[`first`, `middle`) and \[`middle`, `last`) shall be valid
18
- ranges. `ForwardIterator` shall satisfy the requirements of
19
- `ValueSwappable` ([[swappable.requirements]]). The type of `*first`
20
- shall satisfy the requirements of `MoveConstructible`
21
- (Table  [[moveconstructible]]) and the requirements of `MoveAssignable`
22
- (Table  [[moveassignable]]).
23
-
24
  *Complexity:* At most `last - first` swaps.
25
 
26
  ``` cpp
27
  template<class ForwardIterator, class OutputIterator>
28
  OutputIterator
29
- rotate_copy(ForwardIterator first, ForwardIterator middle,
30
- ForwardIterator last, OutputIterator result);
 
 
 
 
 
31
  ```
32
 
 
 
 
33
  *Effects:* Copies the range \[`first`, `last`) to the range \[`result`,
34
  `result + (last - first)`) such that for each non-negative integer
35
  `i < (last - first)` the following assignment takes place:
36
  `*(result + i) = *(first + (i + (middle - first)) % (last - first))`.
37
 
38
  *Returns:* `result + (last - first)`.
39
 
40
- *Requires:* The ranges \[`first`, `last`) and \[`result`,
41
- `result + (last - first)`) shall not overlap.
42
-
43
  *Complexity:* Exactly `last - first` assignments.
44
 
 
1
  ### Rotate <a id="alg.rotate">[[alg.rotate]]</a>
2
 
3
  ``` cpp
4
  template<class ForwardIterator>
5
+ ForwardIterator
6
+ rotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last);
7
+ template<class ExecutionPolicy, class ForwardIterator>
8
+ ForwardIterator
9
+ rotate(ExecutionPolicy&& exec,
10
+ ForwardIterator first, ForwardIterator middle, ForwardIterator last);
11
  ```
12
 
13
+ *Requires:* \[`first`, `middle`) and \[`middle`, `last`) shall be valid
14
+ ranges. `ForwardIterator` shall satisfy the requirements of
15
+ `ValueSwappable` ([[swappable.requirements]]). The type of `*first`
16
+ shall satisfy the requirements of `MoveConstructible`
17
+ (Table  [[tab:moveconstructible]]) and the requirements of
18
+ `MoveAssignable` (Table  [[tab:moveassignable]]).
19
+
20
  *Effects:* For each non-negative integer `i < (last - first)`, places
21
  the element from the position `first + i` into position
22
  `first + (i + (last - middle)) % (last - first)`.
23
 
24
  *Returns:* `first + (last - middle)`.
25
 
26
  *Remarks:* This is a left rotate.
27
 
 
 
 
 
 
 
 
28
  *Complexity:* At most `last - first` swaps.
29
 
30
  ``` cpp
31
  template<class ForwardIterator, class OutputIterator>
32
  OutputIterator
33
+ rotate_copy(ForwardIterator first, ForwardIterator middle, ForwardIterator last,
34
+ OutputIterator result);
35
+ template<class ExecutionPolicy, class ForwardIterator1, class ForwardIterator2>
36
+ ForwardIterator2
37
+ rotate_copy(ExecutionPolicy&& exec,
38
+ ForwardIterator1 first, ForwardIterator1 middle, ForwardIterator1 last,
39
+ ForwardIterator2 result);
40
  ```
41
 
42
+ *Requires:* The ranges \[`first`, `last`) and \[`result`,
43
+ `result + (last - first)`) shall not overlap.
44
+
45
  *Effects:* Copies the range \[`first`, `last`) to the range \[`result`,
46
  `result + (last - first)`) such that for each non-negative integer
47
  `i < (last - first)` the following assignment takes place:
48
  `*(result + i) = *(first + (i + (middle - first)) % (last - first))`.
49
 
50
  *Returns:* `result + (last - first)`.
51
 
 
 
 
52
  *Complexity:* Exactly `last - first` assignments.
53