tmp/tmpvhq8a5pp/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### `ranges::advance` <a id="range.iter.op.advance">[[range.iter.op.advance]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<input_or_output_iterator I>
|
| 5 |
+
constexpr void ranges::advance(I& i, iter_difference_t<I> n);
|
| 6 |
+
```
|
| 7 |
+
|
| 8 |
+
*Preconditions:* If `I` does not model `bidirectional_iterator`, `n` is
|
| 9 |
+
not negative.
|
| 10 |
+
|
| 11 |
+
*Effects:*
|
| 12 |
+
|
| 13 |
+
- If `I` models `random_access_iterator`, equivalent to `i += n`.
|
| 14 |
+
- Otherwise, if `n` is non-negative, increments `i` by `n`.
|
| 15 |
+
- Otherwise, decrements `i` by `-n`.
|
| 16 |
+
|
| 17 |
+
``` cpp
|
| 18 |
+
template<input_or_output_iterator I, sentinel_for<I> S>
|
| 19 |
+
constexpr void ranges::advance(I& i, S bound);
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
*Preconditions:* \[`i`, `bound`) denotes a range.
|
| 23 |
+
|
| 24 |
+
*Effects:*
|
| 25 |
+
|
| 26 |
+
- If `I` and `S` model `assignable_from<I&, S>`, equivalent to
|
| 27 |
+
`i = std::move(bound)`.
|
| 28 |
+
- Otherwise, if `S` and `I` model `sized_sentinel_for<S, I>`, equivalent
|
| 29 |
+
to `ranges::advance(i, bound - i)`.
|
| 30 |
+
- Otherwise, while `bool(i != bound)` is `true`, increments `i`.
|
| 31 |
+
|
| 32 |
+
``` cpp
|
| 33 |
+
template<input_or_output_iterator I, sentinel_for<I> S>
|
| 34 |
+
constexpr iter_difference_t<I> ranges::advance(I& i, iter_difference_t<I> n, S bound);
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
*Preconditions:* If `n > 0`, \[`i`, `bound`) denotes a range. If
|
| 38 |
+
`n == 0`, \[`i`, `bound`) or \[`bound`, `i`) denotes a range. If
|
| 39 |
+
`n < 0`, \[`bound`, `i`) denotes a range, `I` models
|
| 40 |
+
`bidirectional_iterator`, and `I` and `S` model `same_as<I, S>`.
|
| 41 |
+
|
| 42 |
+
*Effects:*
|
| 43 |
+
|
| 44 |
+
- If `S` and `I` model `sized_sentinel_for<S, I>`:
|
| 45 |
+
- If |`n`| ≥ |`bound - i`|, equivalent to `ranges::advance(i, bound)`.
|
| 46 |
+
- Otherwise, equivalent to `ranges::advance(i, n)`.
|
| 47 |
+
- Otherwise,
|
| 48 |
+
- if `n` is non-negative, while `bool(i != bound)` is `true`,
|
| 49 |
+
increments `i` but at most `n` times.
|
| 50 |
+
- Otherwise, while `bool(i != bound)` is `true`, decrements `i` but at
|
| 51 |
+
most `-n` times.
|
| 52 |
+
|
| 53 |
+
*Returns:* `n - `M, where M is the difference between the ending and
|
| 54 |
+
starting positions of `i`.
|
| 55 |
+
|