From Jason Turner

[alg.shift]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1ighdvmm/{from.md → to.md} +40 -13
tmp/tmp1ighdvmm/{from.md → to.md} RENAMED
@@ -7,23 +7,34 @@ template<class ForwardIterator>
7
  typename iterator_traits<ForwardIterator>::difference_type n);
8
  template<class ExecutionPolicy, class ForwardIterator>
9
  ForwardIterator
10
  shift_left(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
11
  typename iterator_traits<ForwardIterator>::difference_type n);
 
 
 
 
 
 
12
  ```
13
 
14
- *Preconditions:* `n >= 0` is `true`. The type of `*first` meets the
15
- *Cpp17MoveAssignable* requirements.
 
16
 
17
  *Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
18
  moves the element from position `first + n + i` into position
19
- `first + i` for each non-negative integer `i < (last - first) - n`. In
20
- the first overload case, does so in order starting from `i = 0` and
21
- proceeding to `i = (last - first) - n - 1`.
 
22
 
23
- *Returns:* `first + (last - first - n)` if `n < last - first`, otherwise
24
- `first`.
 
 
 
25
 
26
  *Complexity:* At most `(last - first) - n` assignments.
27
 
28
  ``` cpp
29
  template<class ForwardIterator>
@@ -32,23 +43,39 @@ template<class ForwardIterator>
32
  typename iterator_traits<ForwardIterator>::difference_type n);
33
  template<class ExecutionPolicy, class ForwardIterator>
34
  ForwardIterator
35
  shift_right(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
36
  typename iterator_traits<ForwardIterator>::difference_type n);
 
 
 
 
 
 
37
  ```
38
 
39
- *Preconditions:* `n >= 0` is `true`. The type of `*first` meets the
40
- *Cpp17MoveAssignable* requirements. `ForwardIterator` meets the
 
41
  *Cpp17BidirectionalIterator* requirements [[bidirectional.iterators]] or
42
  the *Cpp17ValueSwappable* requirements.
43
 
44
  *Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
45
  moves the element from position `first + i` into position
46
  `first + n + i` for each non-negative integer `i < (last - first) - n`.
47
- In the first overload case, if `ForwardIterator` meets the
48
- *Cpp17BidirectionalIterator* requirements, does so in order starting
49
- from `i = (last - first) - n - 1` and proceeding to `i = 0`.
50
 
51
- *Returns:* `first + n` if `n < last - first`, otherwise `last`.
 
 
 
 
 
 
 
 
 
 
52
 
53
  *Complexity:* At most `(last - first) - n` assignments or swaps.
54
 
 
7
  typename iterator_traits<ForwardIterator>::difference_type n);
8
  template<class ExecutionPolicy, class ForwardIterator>
9
  ForwardIterator
10
  shift_left(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
11
  typename iterator_traits<ForwardIterator>::difference_type n);
12
+
13
+ template<permutable I, sentinel_for<I> S>
14
+ constexpr subrange<I> ranges::shift_left(I first, S last, iter_difference_t<I> n);
15
+ template<forward_range R>
16
+ requires permutable<iterator_t<R>>
17
+ constexpr borrowed_subrange_t<R> ranges::shift_left(R&& r, range_difference_t<R> n)
18
  ```
19
 
20
+ *Preconditions:* `n >= 0` is `true`. For the overloads in namespace
21
+ `std`, the type of `*first` meets the *Cpp17MoveAssignable*
22
+ requirements.
23
 
24
  *Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
25
  moves the element from position `first + n + i` into position
26
+ `first + i` for each non-negative integer `i < (last - first) - n`. For
27
+ the overloads without an `ExecutionPolicy` template parameter, does so
28
+ in order starting from `i = 0` and proceeding to
29
+ `i = (last - first) - n - 1`.
30
 
31
+ *Returns:* Let *NEW_LAST* be `first + (last - first - n)` if
32
+ `n < last - first`, otherwise `first`.
33
+
34
+ - *NEW_LAST* for the overloads in namespace `std`.
35
+ - `{first, `*`NEW_LAST`*`}` for the overloads in namespace `ranges`.
36
 
37
  *Complexity:* At most `(last - first) - n` assignments.
38
 
39
  ``` cpp
40
  template<class ForwardIterator>
 
43
  typename iterator_traits<ForwardIterator>::difference_type n);
44
  template<class ExecutionPolicy, class ForwardIterator>
45
  ForwardIterator
46
  shift_right(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
47
  typename iterator_traits<ForwardIterator>::difference_type n);
48
+
49
+ template<permutable I, sentinel_for<I> S>
50
+ constexpr subrange<I> ranges::shift_right(I first, S last, iter_difference_t<I> n);
51
+ template<forward_range R>
52
+ requires permutable<iterator_t<R>>
53
+ constexpr borrowed_subrange_t<R> ranges::shift_right(R&& r, range_difference_t<R> n);
54
  ```
55
 
56
+ *Preconditions:* `n >= 0` is `true`. For the overloads in namespace
57
+ `std`, the type of `*first` meets the *Cpp17MoveAssignable*
58
+ requirements, and `ForwardIterator` meets the
59
  *Cpp17BidirectionalIterator* requirements [[bidirectional.iterators]] or
60
  the *Cpp17ValueSwappable* requirements.
61
 
62
  *Effects:* If `n == 0` or `n >= last - first`, does nothing. Otherwise,
63
  moves the element from position `first + i` into position
64
  `first + n + i` for each non-negative integer `i < (last - first) - n`.
65
+ Does so in order starting from `i = (last - first) - n - 1` and
66
+ proceeding to `i = 0` if:
 
67
 
68
+ - for the overload in namespace `std` without an `ExecutionPolicy`
69
+ template parameter, `ForwardIterator` meets the
70
+ *Cpp17BidirectionalIterator* requirements,
71
+ - for the overloads in namespace `ranges`, `I` models
72
+ `bidirectional_iterator`.
73
+
74
+ *Returns:* Let *NEW_FIRST* be `first + n` if `n < last - first`,
75
+ otherwise `last`.
76
+
77
+ - *NEW_FIRST* for the overloads in namespace `std`.
78
+ - `{`*`NEW_FIRST`*`, last}` for the overloads in namespace `ranges`.
79
 
80
  *Complexity:* At most `(last - first) - n` assignments or swaps.
81