std::basic_...::operator*(3)

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

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

okay so this is the C++ Standard Library page for std::basic_...::operator*(3) β€” the header says C++ Standard Libary (iconic typo, no notes πŸ’€). It's giving const iterator dereference operators and honestly it ate.

🌸 NAME

std::basic_const_iterator::operator* - std::basic_const_iterator::operator*

(yes bestie, it's listed twice, periodt.)

✨ Synopsis

Overload (1) arrives since C++23:

constexpr std::iter_const_reference_t<Iter> operator*() const;

Overload (2) also arrives since C++23:

constexpr const auto* operator->() const
    requires
        std::is_lvalue_reference_v<std::iter_reference_t<Iterator>> &&
        std::same_as<std::remove_cvref_t<std::iter_reference_t<Iterator>>,
                     value_type>;

okay so the whole vibe: it returns a reference or pointer to the const version of the current element. Highkey useful. 🫢

  1. Returns static_cast<std::iter_const_reference_t<Iter>>(*base()).
  2. If Iter models contiguous_iterator, returns std::to_address(base()); otherwise, returns std::addressof(*base()).

πŸ’– Parameters

(none) β€” literally nobody, bestie. ✨

πŸŽ€ Return value

  1. Reference-to-const that refers to the current element. The result may be a prvalue (e.g. if *base() is a prvalue).
  2. Pointer-to-const that points to the current element.

πŸ¦‹ Example

This section is incomplete

Reason: no example 😭 (not a single example in the group chat).

🌈 See also

  • operator[] accesses an element by index (public member function)

πŸ‘‘ Category

  • Todo no example

xoxo bestie πŸ’… β€” source/version/date: http://cppreference.com, 2024.06.10, page: std::basic_...::operator*(3). Bye 🫢

πŸ“¦ where this page comes from