Class template move_sentinel is a sentinel adaptor useful for denoting ranges together with move_iterator. When an input iterator type I and sentinel type S satisfy Sentinel<S, I>, Sentinel<move_sentinel<S>, move_iterator<I>> is satisfied as well.
[ Example: A move_if algorithm is easily implemented with copy_if using move_iterator and move_sentinel:
template <InputIterator I, Sentinel<I> S, WeaklyIncrementable O, IndirectUnaryPredicate<I> Pred> requires IndirectlyMovable<I, O> void move_if(I first, S last, O out, Pred pred){ copy_if(move_iterator<I>{first}, move_sentinel<S>{last}, out, pred); }
— end example ]
namespace std { namespace experimental { namespace ranges { inline namespace v1 {
template <Semiregular S>
class move_sentinel {
public:
constexpr move_sentinel();
explicit move_sentinel(S s);
move_sentinel(const move_sentinel<ConvertibleTo<S>>& s);
move_sentinel& operator=(const move_sentinel<ConvertibleTo<S>>& s);
S base() const;
private:
S last; // exposition only
};
template <class I, Sentinel<I> S>
constexpr bool operator==(
const move_iterator<I>& i, const move_sentinel<S>& s);
template <class I, Sentinel<I> S>
constexpr bool operator==(
const move_sentinel<S>& s, const move_iterator<I>& i);
template <class I, Sentinel<I> S>
constexpr bool operator!=(
const move_iterator<I>& i, const move_sentinel<S>& s);
template <class I, Sentinel<I> S>
constexpr bool operator!=(
const move_sentinel<S>& s, const move_iterator<I>& i);
template <class I, SizedSentinel<I> S>
constexpr difference_type_t<I> operator-(
const move_sentinel<S>& s, const move_iterator<I>& i);
template <class I, SizedSentinel<I> S>
constexpr difference_type_t<I> operator-(
const move_iterator<I>& i, const move_sentinel<S>& s);
template <Semiregular S>
constexpr move_sentinel<S> make_move_sentinel(S s);
}}}}