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

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

πŸ’… std::ranges...ange::begin(3) β€” bestie edition πŸ’…

Okay so this page lives in the C++ Standard Libary manual, and today’s main character is std::ranges::subrange::begin. The whole vibe: you get the iterator to the first element of the subrange, or the end iterator if the view is empty. Slay. ✨

🌸 NAME 🌸

std::ranges::subrange::begin - std::ranges::subrange::begin

✨ Synopsis ✨

          constexpr I begin() const requires std::copyable<I>;            (1)
       (since C++20)
          [[nodiscard]] constexpr I begin() requires (!std::copyable<I>); (2)
       (since C++20)

Obtains the iterator to the first element of the subrange, or the end iterator if the view is empty.

There’s a lil manual visual called range-begin-end.svg β€” beginning/end diagram vibes. πŸ¦‹

  1. Returns a copy of the stored iterator if the iterator type is copyable.
  2. Returns an iterator move-constructed from the stored iterator if the iterator type is not copyable.

πŸŽ€ Parameters πŸŽ€

(none) β€” zero, nada, no parameters, bestie. πŸ’…

⭐ Return value ⭐

  1. An iterator copy-constructed from the stored iterator.
  2. An iterator move-constructed from the stored iterator.

πŸ’œ Notes πŸ’œ

A call to (2) may leave the stored iterator in a valid but unspecified state, depending on the behavior of the move constructor of I. So like… valid, but not necessarily the same, okay? 😭

πŸ“ Example πŸ“

This section is incomplete. Reason: no example.

πŸ¦‹ See also πŸ¦‹

  • end β€” obtains the sentinel; (C++20); (public member function)
  • begin, cbegin β€” returns an iterator to the beginning of a container or array; (C++11); (function template); (C++14)
  • ranges::begin β€” returns an iterator to the beginning of a range; (C++20); (customization point object)

πŸ‘‘ Category πŸ‘‘

* Todo no example


XOXO, your fave manual πŸ’– source/version/date/page: http://cppreference.com, 2024.06.10, std::ranges...ange::begin(3). Mwah! πŸ’‹βœ¨

πŸ“¦ where this page comes from