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

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

πŸŽ€ NAME πŸŽ€

okay so welcome to std::ranges...r::operator*(3) β€” the std::ranges::stride_view::iterator::operator* page from the C++ Standard Libary (their spelling, not mine πŸ’…), manual section 3.

  • std::ranges::stride_view::iterator::operator*
  • std::ranges::stride_view::iterator::operator*

yep, the NAME section lists it twice, and we are not erasing one β€” both stay, bestie πŸ’–


πŸ¦‹ Synopsis πŸ¦‹

constexpr decltype(auto) operator*() const;  (since C++23)

Returns the elements into V the underlying iterator current_ points to.

Equivalent to: return *current_;.


πŸŽ€ Parameters πŸŽ€

(none) β€” literally no parameters, not a single one 🫢


πŸ’– Return value πŸ’–

The current element. That's it. That's the whole vibe ✨


🌸 Notes 🌸

operator-> is not provided.

no operator->, no cap. it's giving "you get the dereference and that's the whole story" πŸ’€

πŸ”₯ Example πŸ”₯

// Run this code

#include <ranges>

int main()
{
    constexpr static auto v = {'a', 'b', 'c', 'd', 'e'};
    constexpr auto view{v | std::views::stride(2)};
    constexpr auto iter{view.begin() + 1};
    static_assert(*iter == 'c');
    static_assert(*(view.begin() + 2) == 'e');
}

πŸ‘‘ See also πŸ‘‘

  • operator[] β€” accesses an element by index, marked (C++23) and (public member function) πŸ’…

xoxo, your local Unix bestie πŸ§šπŸ’– β€” this page came from http://cppreference.com, dated 2024.06.10, and it's std::ranges...r::operator*(3). periodt ✨

πŸ“¦ where this page comes from