std::ranges::sized_range, std::ranges::disable_sized_range
From cppreference.com
Defined in header <ranges>
|
||
template< class T > concept sized_range = ranges::range<T> && |
(1) | |
template<class> inline constexpr bool disable_sized_range = false; |
(2) | |
1) The sized_range concept specifies the requirements of a range type that knows its size in constant time with the size function.
Formally, given an lvalue t of type std::remove_reference_t<T>, T models sized_range only if
- ranges::size(t)
- has non-amortized constant-time complexity,
- does not modify t, and
- is equal to ranges::distance(t), and
- if iterator_t<T> models forward_iterator, ranges::size(t) is well-defined regardless of the evaluation of ranges::begin(t) (in other words, a single-pass sized range may support a call to size only before the first call to begin, but a forward range must support size at all times)
2) disable_sized_range exists to allows use of range types that satisfy but do not in fact model sized_range.
Notes
Users may specialize disable_sized_range
for cv-unqualified program-defined types. Such specializations shall be usable in constant expressions and have type const bool
.