SysTutorials

Linux Manual Pages › Section 3

stdexperimentalrangessizedsentinel(3)

std::experimental::ranges::SizedSentinel - std::experimental::ranges::SizedSentinel

Synopsis

Defined in header<experimental / ranges / iterator>
    template <class S, class I>
    concept bool SizedSentinel =
        Sentinel<S, I> &&
        !ranges::disable_sized_sentinel<std::remove_cv_t<S>, std::remove_cv_t<I>> && (1)(ranges TS)
                                                                                         requires(const I &i, const S &s)
{
    {
        s - i
        } -> Same<ranges::difference_type_t<I>> &&;
    {
        i - s
        } -> Same<ranges::difference_type_t<I>> &&;
};
template <class S, class I>
(1)(ranges TS)
    constexpr bool disable_sized_sentinel = false;

The SizedSentinel concept specifies that an object of the iterator type I and an object of the sentinel type S can be subtracted to compute the distance between them in constant time. Let i be an iterator of type I, and s a sentinel of type S such that [i, s) denotes a range. Let N be the smallest number of applications of ++i necessary to make bool(i == s) be true. Then SizedSentinel<S, I> is satisfied only if: