std::basic_...::operator[](3)

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

std::basic_...::operator[](3) πŸ’…

okay bestie, welcome to the C++ Standard Libary manual page β€” yes, Libary is spelled like that in the source, and we are not fixing it, we are respecting the lore. The title on deck is std::basic_...::operator[](3), and this whole page is about the std::basic_const_iterator::operator[] vibe. 🫢


NAME ✨

The NAME block is literally std::basic_const_iterator::operator[] - followed by std::basic_const_iterator::operator[]. Yes, it's the same name twice with a dash moment. iconic behavior. πŸ’…

Synopsis 🌸

          constexpr std::iter_const_reference_t<Iter> operator[](
          difference_type n ) const

This one is (since C++23), and it requires std::random_access_iterator<Iterator>;.

It returns a reference to the element at specified relative location. no cap, that's the whole synopsis.

Parameters πŸŽ€

  • n β€” position relative to current location.

Return value πŸ’–

A reference-to-const to the element at relative location, and the exact expression is static_cast<std::iter_const_reference_t<Iter>>(base()[n]).

Example 😭

This section is incomplete.

Reason: no example.

bestie they really left us hanging with no example. it's giving "trust me, the signature is the example." πŸ’€

See also πŸ”₯

  • operator* β€” accesses the pointed-to element.
  • operator-> β€” public member function.

Category: πŸ‘‘

  • * Todo no example

xoxo, signing off with source http://cppreference.com, version/date 2024.06.10, and the footer title std::basic_...::operator[](3) β€” stay random-access, bestie πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from