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

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

πŸ’… std::ranges::elements_view::begin β€” no cap, it's giving first element

okay so bestie, welcome to the C++ Standard Libary section of the manual, and today's main character is std::ranges::elements_view::begin. She's the one who gets you to the front of the line πŸ’–


✨ SYNOPSIS ✨

constexpr auto begin() requires (!__SimpleView<V>);           (1)
(since C++20)
constexpr auto begin() const requires ranges::range<const V>; (2)
(since C++20)

Two overloads, both living their best constexpr life, both here since C++20 πŸŽ€


🌸 DESCRIPTION 🌸

She returns an iterator to the first element of the elements_view. Literally just the glow-up at position zero ✨

Let base_ be the underlying view. Here's how the two overloads shake out:

  1. Equivalent to return /*iterator*/<false>(ranges::begin(base_));. πŸ‘‘
  2. Equivalent to return /*iterator*/<true>(ranges::begin(base_));. πŸ’…

(Yes, overload 1 has that requires (!__SimpleView<V>) gate and overload 2 is the const one with requires ranges::range<const V> β€” no notes, that's exactly how she's built.)


πŸ¦‹ PARAMETERS πŸ¦‹

(none)

Nothing to pass in, she's low-maintenance fr fr 🫢


🌈 RETURN VALUE 🌈

An iterator to the first element. That's it, that's the whole vibe ⭐


πŸ“ EXAMPLE πŸ“

This section is incomplete Reason: no example

ngl the docs team left this one blank 😭 no example yet, so go off and write your own iconic snippet πŸ’€


🧚 SEE ALSO 🧚

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

πŸ’œ CATEGORY πŸ’œ

  • Todo no example

k that's the whole page, bestie, you ate that πŸŽ€βœ¨

source: cppreference.com Β· dated 2024.06.10 Β· std::ranges..._view::begin(3) signing off β€” mwah πŸ’‹

πŸ“¦ where this page comes from