std::ranges...w::sentinel(3)
π std::ranges...w::sentinel(3) π
okay so bestie, this is the manual page for std::ranges...w::sentinel from the C++ Standard Libary β yes, that's the manual name, and we're keeping it exactly like that. it's C++20 template territory, so grab a lil snack π and let's get into it. no cap, this one is niche but iconic.
β¨ NAME β¨
std::ranges::iota_view::sentinel β and the NAME line literally repeats it: std::ranges::iota_view::sentinel - std::ranges::iota_view::sentinel. matching set energy, periodt π
πΈ Synopsis πΈ
struct /*sentinel*/; (since C++20)
(exposition only*)
so this is struct /*sentinel*/; since C++20, and it's literally marked exposition only*. the way that it works: it's the return type of iota_view::end, used when the iota_view is bounded (i.e. Bound is not std::unreachable_sentinel_t) and Bound and W are not the same type. that's the whole vibe check π¦
π Member functions π
π
std::ranges::iota_view::sentinel::sentinel
/*sentinel*/() = default; (1) (since C++20)
constexpr explicit /*sentinel*/( Bound bound ); (2) (since C++20)
(1)β/*sentinel*/() = default;(since C++20). Value-initializesbound_via its default member initializer (= Bound()). default constructor ate, no notes β¨(2)βconstexpr explicit /*sentinel*/( Bound bound );(since C++20). Initializesbound_withbound. explicit and unbothered π
π₯ Non-member functions π₯
vibe check before we start: in the following descriptions, value_ is an underlying data member of iterator from which its operator* copies. copy that, bestie π«Ά
β¨ operator==(std::ranges::iota_view::iterator, std::ranges::iota_view::sentinel)
friend constexpr bool operator==( const /*iterator*/& x, (since C++20)
const /*sentinel*/& y );
Equivalent to: return x.value_ == y.bound_;.
The != operator is synthesized from operator==. not me loving synthesized operators π
this function is not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when sentinel is an associated class of the arguments. so don't go looking for it with a plain name, iykyk ππ
π operator-(std::ranges::iota_view::iterator, std::ranges::iota_view::sentinel)
friend constexpr std::iter_difference_t<W>
operator-(const /*iterator*/& x, const /*sentinel*/& y) (1)
(since C++20)
requires std::sized_sentinel_for<Bound, W>;
friend constexpr std::iter_difference_t<W>
operator-(const /*sentinel*/& x, const /*iterator*/& y) (2)
(since C++20)
requires std::sized_sentinel_for<Bound, W>;
- Equivalent to
return x.value_ - y.bound_;. - Equivalent to
return -(y.value_ - x.bound_);.
These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when sentinel is an associated class of the arguments. fr fr, ADL only β that's the rule, bestie π«Ά
mwah π this page came from http://cppreference.com, dated 2024.06.10, and the footer id is std::ranges...w::sentinel(3). byeee, go drink water and maybe touch grass π±π«Ά
π¦ 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