deduction guides for std::ranges::subrange
Defined in header <ranges>
|
||
template
<
std::input_or_output_iterator I, std::sentinel_for
<I> S >
subrange(I, S) - > subrange<I, S> ; |
(1) | (since C++20) |
template
<
std::input_or_output_iterator I, std::sentinel_for
<I> S >
subrange(I, S, /*make-unsigned-like-t*/
<
std::iter_difference_t
<I>>
)
-
>
|
(2) | (since C++20) |
template
<
ranges::borrowed_range
<R>
>
subrange(R&&
)
-
>
|
(3) | (since C++20) |
template
<
ranges::borrowed_range
<R>
>
subrange(R&&, /*make-unsigned-like-t*/
<
ranges::range_difference_t
<R>>
)
-
>
|
(4) | (since C++20) |
These deduction guides are provided for std::ranges::subrange
subrange
is sized if
std::sized_sentinel_for<S, I>
subrange
is always sized.subrange
is sized if the size can be obtained from the range or its iterator and sentinel.subrange
is always sized.For the definition of /* make-unsigned-like-t */, see make-unsigned-like-t
Notes
While constructing the subrange
object,
- for (1,2), the behavior is undefined if the iterator-sentinel pair does not denote a valid range,
- for (2,4), the behavior is undefined if the given size is not equal to the size of the range.
Example
This section is incomplete Reason: no example |
Defect reports
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR | Applied to | Behavior as published | Correct behavior |
---|---|---|---|
LWG 3404 | C++20 | meaningless deduction guides from pair-like types were provided | removed |