std::ranges...m_view::end(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– std::ranges...m_view::end(3) πŸ’–

okay bestie, welcome to the std::ranges...m_view::end(3) page from the C++ Standard Libary manual β€” yes, that’s the exact manual name, typo and all, and the title really does have that ... in it. iconic behavior, no cap. πŸ’…


✨ NAME ✨

std::ranges::transform_view::end - std::ranges::transform_view::end.


πŸŽ€ Synopsis πŸŽ€

          constexpr /*sentinel*/<false> end();
       (1) (since C++20)
          constexpr /*iterator*/<false> end() requires
       (2) (since C++20)
          ranges::common_range<V>;
          constexpr /*sentinel*/<true> end() const

            requires ranges::range<const V> &&
       (3) (since C++20)

                     std::regular_invocable<const F&,
          ranges::range_reference_t<const V>>;
          constexpr /*iterator*/<true> end() const

            requires ranges::common_range<const V> &&
       (4) (since C++20)

                     std::regular_invocable<const F&,
          ranges::range_reference_t<const V>>;

So the vibe is: this gives you back a sentinel or an iterator that represents the end of the transform_view. Four overloads, all since C++20, and they are numbered (1) through (4). slay.

Let base_ be the underlying view. Here’s what each overload is equivalent to, exactly:

  • (1) Equivalent to return /*sentinel*/<false>{ranges::end(base_)};.
  • (2) Equivalent to return /*iterator*/<false>{*this, ranges::end(base_)};.
  • (3) Equivalent to return /*sentinel*/<true>{ranges::end(base_)};.
  • (4) Equivalent to return /*iterator*/<true>{*this, ranges::end(base_)};.

🫢 Parameters 🫢

(none) β€” literally no parameters, bestie. 🫢


🌈 Return value 🌈

  • 1,3) sentinel which compares equal to the end iterator
  • 2,4) iterator to the element following the last element

πŸ¦‹ Notes πŸ¦‹

end() returns an iterator if and only if the underlying view is a common_range:

transform_view<V,F> models common_range whenever V does.

That’s the whole tea. β˜•βœ¨


πŸ“ Example πŸ“

This section is incomplete Reason: no example

not me reading a whole manual page just to find out there’s no example πŸ˜­πŸ’€


πŸ‘‘ See also πŸ‘‘

  • begin β€” returns an iterator to the beginning. (C++20) (public member function)
  • ranges::end β€” returns a sentinel indicating the end of a range. (C++20) (customization point object)

🌸 Category 🌸

Category: * Todo no example


mwah πŸ’‹ β€” source/version/date sign-off: http://cppreference.com, 2024.06.10, and the page is std::ranges...m_view::end(3). πŸŽ€

πŸ“¦ where this page comes from