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

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

πŸŽ€ std::ranges..._view::begin(3) πŸŽ€

okay bestie, welcome to the std::ranges::chunk_by_view::begin page from the C++ Standard Libary manual πŸ’– this is literally the std::ranges..._view::begin(3) one, and yes, we're gonna get through it together 🫢


πŸ’– NAME πŸ’–

  • std::ranges::chunk_by_view::begin - std::ranges::chunk_by_view::begin

like… the name is the name twice, and honestly? iconic πŸ’…


✨ Synopsis ✨

constexpr /*iterator*/ begin();  (since C++23)

This returns an iterator to the first element of the chunk_by_view πŸ‘‘ no cap.

It's equivalent to:

ranges::iterator_t<V> iter;

if (begin_.has_value())
    iter = begin_.value();
else
{
    iter = /*find_next*/(ranges::begin(base()));
    begin_ = iter; // caching
}

return /*iterator*/(*this, ranges::begin(base()), iter);
⚠️ okay so this part is serious: the behavior is undefined if the underlying predicate pred_ does not contain a value. like, undefined is not a vibe, bestie 😭

🫢 Parameters 🫢

  • (none) β€” literally none, bestie. nothing. zero. the void 🌸

🌸 Return value 🌸

Iterator to the first element. periodt ✨


🧚 Notes 🧚

In order to provide the amortized constant-time complexity required by the range concept, this function caches the result within the data member begin_ (the name is for exposition only) for use on subsequent calls πŸ’«

so yeah, it's giving β€œremember it so future calls can slay” πŸŽ€


πŸ“ Example πŸ“

  • This section is incomplete
  • Reason: no example

not me showing up with no example πŸ˜­πŸ™ˆ


πŸ¦‹ See also πŸ¦‹

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

πŸ‘‘ Category πŸ‘‘

  • Todo no example

source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::ranges..._view::begin(3) β€” mwah, that's the whole manual page, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from