std::ranges...e_view::end(3)
β¨ NAME β¨
std::ranges::enumerate_view::end β bestie, it's literally the end of std::ranges::enumerate_view π
Okay so real talk: this page comes from the C++ Standard Libary manual (that's how the page spells it, don't come for me π), and we're about to make end() make sense. Buckle up π
π Synopsis π
Two overloads, both constexpr, both iconic, both since C++23:
constexpr auto end() requires (!__simple_view<V>);
(1) (since C++23)
constexpr auto end() const requires
/*range-with-movable-references*/<const V>;
(2) (since C++23)
So what does it actually do? It returns an iterator or a sentinel that compares equal to the end iterator of the enumerate_view. That's the whole vibe π¦
Let base_ denote the underlying view. (Say it with me: base_ is the underlying view.)
- Overload (1) is equivalent to:
if constexpr (ranges::forward_range<V> and
ranges::common_range<V> and
ranges::sized_range<V>)
return /*iterator*/<false>(ranges::end(base_),
ranges::distance(base_));
else
return /*sentinel*/<false>(ranges::end(base_));
- Overload (2) is equivalent to:
if constexpr (ranges::forward_range<const V> and
ranges::common_range<const V> and
ranges::sized_range<const V>)
return /*iterator*/<true>(ranges::end(base_),
ranges::distance(base_));
else
return /*sentinel*/<true>(ranges::end(base_));
πΈ Parameters πΈ
(none) β zero, nada, it takes no parameters, bestie π«Ά
π Return value π
An iterator or a sentinel representing the end of the enumerate_view, as described above.
π¦ Example π¦
This section is incomplete.
Reason: no example.
It's giving unfinished, ngl π no example yet, periodt.
π₯ Defect reports π₯
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
LWG 3919β applied to C++23. Behavior as published:ranges::distance may invoke UB for sized common non-forward underlying ranges. Correct behavior:sentinel type is returned for such ranges. Slay for fixing that one, fr fr π
π See also π
beginβ returns an iterator to the beginning (C++23) (public member function)ranges::endβ returns a sentinel indicating the end of a range (C++20) (customization point object)
π Category π
- Todo no example
And that's the whole page, bestie π source/version and date moment: http://cppreference.com, 2024.06.10, page title std::ranges...e_view::end(3) β mwah π
π¦ 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