SysTutorials

Linux Manual Pages › Section 3

stdrangesrange(3)

std::ranges::Range - std::ranges::Range

Synopsis

Defined in header<ranges>
    template <class T>
    (1)
        concept Range = __RangeImpl<T &>; // exposition-only definition
// exposition-only helper concept
template <class T>
concept __RangeImpl = requires(T &&t)
{
    (2)
        ranges::begin(std::forward<T>(t)); // equality-preserving for forward iterators
    ranges::end(std::forward<T>(t));
};
// exposition-only helper concept
template <class T>
(3)
    concept __ForwardingRange = Range<T> && __RangeImpl<T>;
  1. The Range concept defines the requirements of a type that allows iteration over its elements by providing an iterator and sentinel that denote the elements of the range. Formally, given an expression E such that decltype((E)) is T, T models Range only if
  1. The exposition-only concept __ForwardingRange defines the requirements of a range such that a function can take it by value and return iterators obtained from it without danger of dangling. Formally, given an expression E such that decltype((E)) is T and an lvalue t that denotes the same object as E, T models __ForwardingRange only if