std::ranges...::operator[](3)
π NAME π
Bestie, the full name is std::ranges::enumerate_view::iterator::operator[] β and yeah, they listed it twice, so we're listing it twice too: std::ranges::enumerate_view::iterator::operator[]. It's giving "government name plus middle names plus confirmation name" energy, but we respect it π«Ά. Also quick heads up, this page lives in the C++ Standard Libary manual β that's their spelling, not mine, we love them anyway β¨.
π Synopsis π
Okay so here's the whole entire vibe:
constexpr auto operator[]( difference_type n ) const (since C++23)
requires ranges::random_access_range<Base>
That (since C++23)? New era, fresh start, main character debut π. And the requires ranges::random_access_range<Base> line is the vibe check β your Base has to be a random access range or this whole function simply does not apply to you, periodt.
She returns an element at a specified relative location. Equivalent to:
return reference-type(pos_ + n, current_[n]);.
(Yeah the trailing period is part of it, keep it exactly, don't come for me π.)
π Parameters π
nβ position relative to current location. That's the whole parameter, she's simple, she's effective, she's booked and busy.
πΈ Return value πΈ
The element at displacement n relative to the current location. You point at a spot, she hands you the element, iconic behavior honestly π
.
π¦ Example π¦
This section is incomplete Reason: no example
Not them leaving us on read π. No example yet bestie, we wait patiently, we stay hydrated π.
π See also π
operator*β accesses the element (C++23) (public member function). Your other bestie for getting your hands on the goods π₯.
π Category π
- Todo: no example. Yeah they really said "figure it out yourself" π β same energy as the Example section, consistent queen.
That's the page, bestie! It's from the C++ Standard Libary manual over at cppreference.com, dated 2024.06.10, for std::ranges...::operator[](3). Go forth and random-access-range responsibly, ily, bye π§πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms