std::ranges..._view::begin(3)

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

πŸ’… std::ranges::join_view::begin πŸ’…

Header says std::ranges..._view::begin(3), from the C++ Standard Libary manual β€” yes, that's the header spelling, and I'm keeping it, bestie. This page is giving overload energy, and we're gonna read every crumb. ✨

✨ NAME ✨

std::ranges::join_view::begin β€” like, the actual begin member of std::ranges::join_view. No cap.

🌸 Synopsis 🌸

constexpr auto begin();

(1) (since C++20)

constexpr auto begin() const
    requires ranges::input_range<const V> &&
             std::is_reference_v<ranges::range_reference_t<const V>>;

(2) (since C++20)

Returns an iterator to the first element of the join_view. Given base_ is the underlying view:

  1. Equivalent to return /*iterator*/<true>{*this, ranges::begin(base_)}; if __SimpleView<V> is satisfied and ranges::range_reference_t<V> is reference type. Otherwise, equivalent to return /*iterator*/<false>{*this, ranges::begin(base_)};.
  2. Equivalent to return /*iterator*/<true>{*this, ranges::begin(base_)};.

πŸŽ€ Parameters πŸŽ€

(none) β€” literally none, not a single argument. Slay.

πŸ’– Return value πŸ’–

An iterator to the first element. Periodt.

🧚 Notes 🧚

Here's the important tea: when ranges::range_reference_t<V> is not a reference type β€” that is, when deferencing an iterator of V returns a prvalue temporary β€” the join_view is only an input_range. In that case only single-pass iteration is supported, and repeated calls to begin() may not give meaningful results.

⚠️ so yeah, if that reference-type condition isn't met, don't expect repeated begin() calls to be cute and stable. Single-pass only, bestie. πŸ’€

πŸ“ Example πŸ“

This section is incomplete. Reason: no example.

πŸ™ˆ the page really says "This section is incomplete" and "Reason: no example". That's the whole example section. Iconic in a tragic way.

🌈 See also 🌈

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

πŸ¦‹ Category πŸ¦‹

  • * Todo no example

Source/version/date check: http://cppreference.com, 2024.06.10, filed under std::ranges..._view::begin(3) β€” mwah πŸ’‹, that's the sign-off, bestie. 🫢

πŸ“¦ where this page comes from