deductiongu...es::subrange(3)
πΈ NAME πΈ
okay bestie, this is the manual page for deductiongu...es::subrange(3) from the C++ Standard Libary β yes, that's the header's spelling, not mine π. The NAME line is literally deductionguidesforstd::ranges::subrange β deductionguidesforstd::ranges::subrange. no cap, that's the whole name. π
β¨ Synopsis β¨
Defined in header <ranges>
(1) (since C++20)
template< std::input_or_output_iterator I, std::sentinel_for<I> S >
subrange(I, S) -> subrange<I, S>;
(2) (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>>)
-> subrange<I, S, ranges::subrange_kind::sized>;
(3) (since C++20)
template< ranges::borrowed_range<R> >
subrange(R&&) ->
subrange<ranges::iterator_t<R>, ranges::sentinel_t<R>,
(ranges::sized_range<R> ||
std::sized_sentinel_for<ranges::sentinel_t<R>, ranges::iterator_t<R>>) ?
ranges::subrange_kind::sized :
ranges::subrange_kind::unsized>;
(4) (since C++20)
template< ranges::borrowed_range<R> >
subrange(R&&, /*make-unsigned-like-t*/<ranges::range_difference_t<R>>) ->
subrange<ranges::iterator_t<R>, ranges::sentinel_t<R>,
ranges::subrange_kind::sized>;
These deduction guides are provided for std::ranges::subrange. π«Ά
- Deduces the template arguments from the type of iterator and sentinel. The subrange is sized if
std::sized_sentinel_for<S, I>is satisfied, as determined by the default template argument. - Deduces the template arguments from the type of iterator and sentinel, while the size of range is specified. The subrange is always sized.
- Deduces the template arguments from the type of range. The subrange is sized if the size can be obtained from the range or its iterator and sentinel.
- Deduces the template arguments from the type of range, while the size of range is specified. The subrange is always sized.
The exposition-only alias template make-unsigned-like-t maps each integer-like type to its corresponding unsigned version. β¨
π Notes π
While constructing the subrange object, bestie:
- 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.
undefined behavior is not a vibe π please respect the valid range and the size, fr fr.
π 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:
LWG 3404- Applied to:
C++20 - Behavior as published: meaningless deduction guides from pair-like types were provided
- Correct behavior: removed
- Applied to:
π Category π
* Todo no example
okay that's the whole manual page, bestie π β it lives at http://cppreference.com, dated 2024.06.10, and the footer label is deductiongu...es::subrange(3). go off, deduction guides, periodt. πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms