std::ranges...r::operator*(3)

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

πŸŽ€ NAME πŸŽ€

okay so we're in the C++ Standard Libary manual (yes, that's how it's spelled up top πŸ’…), on the page for std::ranges::adjacent_view::iterator::operator* β€” footer name std::ranges...r::operator*(3), if you're keeping track.

And the NAME section literally says std::ranges::adjacent_view::iterator::operator* again. Double name, double slay ✨

πŸ’… Synopsis πŸ’…

The signature is a whole mood:

constexpr auto operator*() const;

(since C++23) β€” this one's tagged as C++23, bestie. Not before, no cap.

🌸 Parameters 🌸

(none) β€” zero, nada, nothing to pass in 🫢

πŸ¦‹ Return value πŸ¦‹

The current element, which is a std::tuple of references to underlying elements. So it's giving tuple-of-refs energy, lowkey iconic.

⭐ Notes ⭐

operator-> is not provided. That's the whole note. No arrow, no cap, it's just not provided πŸ’€

πŸ”₯ Example πŸ”₯

Run this code, bestie:

// Run this code

#include <ranges>
#include <tuple>

int main()
{
    constexpr static auto v = {0, 1, 2, 3, 4, 5};
    //                               β””β”€β”€β”¬β”€β”€β”˜
    //                                  └─────────────────┐
    constexpr auto view {v | std::views::adjacent<3>}; // β”‚
    constexpr auto iter {view.begin() + 2};            // β”‚
    //              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    //              β”‚                 β”Œβ”€β”€β”΄β”€β”€β”
    static_assert(*iter == std::tuple{2, 3, 4});
}

🌈 See also 🌈

  • operator[] β€” accesses an element by index; (C++23) (public member function)

This page is from http://cppreference.com, with version/date 2024.06.10, and the full footer name is std::ranges...r::operator*(3). Bye bestie, go dereference something cute πŸ’–βœ¨

πŸ“¦ where this page comes from