| ||||||||||||||||||||||
| Range primitives | |||||||
| |||||||
| Range concepts | |||||||||||||||||||
| |||||||||||||||||||
| Range factories | |||||||||
| |||||||||
| Range adaptors | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Helper items | |||||||||||||||||
| |||||||||||||||||
subrange() requiresstd::default_initializable<I>=default; | (1) | (since C++20) |
constexpr subrange(/*convertible-to-non-slicing*/<I>auto i, S s) requires(!/*StoreSize*/); | (2) | (since C++20) |
constexpr subrange(/*convertible-to-non-slicing*/<I>auto i, S s, /*make-unsigned-like-t*/<std::iter_difference_t<I>> n) | (3) | (since C++20) |
template</*different-from*/<subrange> R> requiresranges::borrowed_range<R>&& | (4) | (since C++20) |
template<ranges::borrowed_range R> requires/*convertible-to-non-slicing*/<ranges::iterator_t<R>, I>&& | (5) | (since C++20) |
Constructs asubrange.
For the definitions of/*make-unsigned-like-t*/ and/*different-from*/, seemake-unsigned-like-t anddifferent-from respectively.
| Overload | Data members | ||
|---|---|---|---|
begin_ | end_ | size_(only if StoreSize istrue) | |
| (1) | value-initialized | value-initialized | initialized with0 |
| (2) | initialized withstd::move(i) | initialized withs | N/A |
| (3) | initialized withn | ||
| (4) | initialized withstd::move(ranges::begin(r)) | initialized withranges::end(r) | initialized withstatic_cast<decltype(size_ )> (ranges::size(r)) |
| (5) | initialized withn | ||
[i, s) is not a valid range. to-unsigned-like (ranges::distance(i, s)) isfalse.| i | - | iterator that denotes the beginning of the range |
| s | - | sentinel that denotes the end of the range |
| r | - | range |
| n | - | size hint, must be equal to the size of the range |
| This section is incomplete Reason: no example |
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| P2393R1 | C++20 | for overload(4),size_ might be initialized withranges::size(r), but it isnot always implicitly convertible to the correspondingunsigned-integer-like type | made the conversion explicit |