std::ranges::subrange<I,S,K>::subrange
requires (!/*StoreSize*/);
/*make-unsigned-like-t*/<std::iter_difference_t <I>> n )
requires ranges::borrowed_range <R> &&
/*convertible-to-non-slicing*/<ranges::iterator_t <R>, I> &&
std::convertible_to <ranges::sentinel_t <R>, S>
constexpr subrange( R&& r )
requires /*convertible-to-non-slicing*/<ranges::iterator_t <R>, I> &&
std::convertible_to <ranges::sentinel_t <R>, S>
constexpr subrange( R&& r,
/*make-unsigned-like-t*/<std::iter_difference_t <I>> n )
requires (K == ranges::subrange_kind::sized)
Constructs a subrange
.
For the definitions of /*make-unsigned-like-t*/ and /*different-from*/, see make-unsigned-like-t
and different-from
respectively.
Overload | Data members | ||
---|---|---|---|
begin_
|
end_
|
size_ (only if StoreSize is true)
| |
(1) | value-initialized | value-initialized | initialized with 0 |
(2) | initialized with std::move(i) | initialized with s | N/A |
(3) | initialized with n | ||
(4) | initialized with std::move(ranges::begin (r)) | initialized with ranges::end (r) | initialized with static_cast<decltype(size_ )> (ranges::size (r))
|
(5) | initialized with n |
-
[
i,
s)
is not a valid range. - n ==
to-unsigned-like
(ranges::distance (i, s)) is false.
[edit] Parameters
[edit] Example
Reason: no example
[edit] Defect reports
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 with ranges::size (r), but it isnot always implicitly convertible to the corresponding unsigned-integer-like type |
made the conversion explicit |