tmp/tmphzr59i6f/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Shift <a id="alg.shift">[[alg.shift]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class ForwardIterator>
|
| 5 |
+
constexpr ForwardIterator
|
| 6 |
+
shift_left(ForwardIterator first, ForwardIterator last,
|
| 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>
|
| 30 |
+
constexpr ForwardIterator
|
| 31 |
+
shift_right(ForwardIterator first, ForwardIterator last,
|
| 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 |
+
|