tmp/tmps_rzvlpz/{from.md → to.md}
RENAMED
|
@@ -2,11 +2,11 @@
|
|
| 2 |
|
| 3 |
Class template `move_sentinel` is a sentinel adaptor useful for denoting
|
| 4 |
ranges together with `move_iterator`. When an input iterator type `I`
|
| 5 |
and sentinel type `S` model `sentinel_for<S, I>`, `move_sentinel<S>` and
|
| 6 |
`move_iterator<I>` model
|
| 7 |
-
`sentinel_for<move_sentinel<S>, move_iterator<I>
|
| 8 |
|
| 9 |
[*Example 1*:
|
| 10 |
|
| 11 |
A `move_if` algorithm is easily implemented with `copy_if` using
|
| 12 |
`move_iterator` and `move_sentinel`:
|
|
@@ -14,11 +14,12 @@ A `move_if` algorithm is easily implemented with `copy_if` using
|
|
| 14 |
``` cpp
|
| 15 |
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 16 |
indirect_unary_predicate<I> Pred>
|
| 17 |
requires indirectly_movable<I, O>
|
| 18 |
void move_if(I first, S last, O out, Pred pred) {
|
| 19 |
-
|
|
|
|
| 20 |
}
|
| 21 |
```
|
| 22 |
|
| 23 |
— *end example*]
|
| 24 |
|
|
@@ -35,10 +36,11 @@ namespace std {
|
|
| 35 |
template<class S2>
|
| 36 |
requires assignable_from<S&, const S2&>
|
| 37 |
constexpr move_sentinel& operator=(const move_sentinel<S2>& s);
|
| 38 |
|
| 39 |
constexpr S base() const;
|
|
|
|
| 40 |
private:
|
| 41 |
S last; // exposition only
|
| 42 |
};
|
| 43 |
}
|
| 44 |
```
|
|
|
|
| 2 |
|
| 3 |
Class template `move_sentinel` is a sentinel adaptor useful for denoting
|
| 4 |
ranges together with `move_iterator`. When an input iterator type `I`
|
| 5 |
and sentinel type `S` model `sentinel_for<S, I>`, `move_sentinel<S>` and
|
| 6 |
`move_iterator<I>` model
|
| 7 |
+
`sentinel_for<move_sentinel<S>, move_iterator<I>>` as well.
|
| 8 |
|
| 9 |
[*Example 1*:
|
| 10 |
|
| 11 |
A `move_if` algorithm is easily implemented with `copy_if` using
|
| 12 |
`move_iterator` and `move_sentinel`:
|
|
|
|
| 14 |
``` cpp
|
| 15 |
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
|
| 16 |
indirect_unary_predicate<I> Pred>
|
| 17 |
requires indirectly_movable<I, O>
|
| 18 |
void move_if(I first, S last, O out, Pred pred) {
|
| 19 |
+
ranges::copy_if(move_iterator<I>{std::move(first)}, move_sentinel<S>{last},
|
| 20 |
+
std::move(out), pred);
|
| 21 |
}
|
| 22 |
```
|
| 23 |
|
| 24 |
— *end example*]
|
| 25 |
|
|
|
|
| 36 |
template<class S2>
|
| 37 |
requires assignable_from<S&, const S2&>
|
| 38 |
constexpr move_sentinel& operator=(const move_sentinel<S2>& s);
|
| 39 |
|
| 40 |
constexpr S base() const;
|
| 41 |
+
|
| 42 |
private:
|
| 43 |
S last; // exposition only
|
| 44 |
};
|
| 45 |
}
|
| 46 |
```
|