std::ranges...or::iterator(3)

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

πŸ’– std::ranges::cartesian_product_view::iterator::iterator πŸ’–

okay bestie, welcome to the C++ Standard Libary β€” yes, that's literally how it's spelled in the header, they forgot the r but we still slay πŸ’… β€” section (3). this page is all about the iterator constructor, and it's giving deep template lore, but I got you. let's go 🫢


🌸 NAME 🌸

std::ranges::cartesian_product_view::iterator::iterator β€” that's the whole name, periodt. it's the constructor for the iterator of cartesian_product_view. iconic.

✨ SYNOPSIS ✨

okay so there are three constructors in the mix, and here's the exact code, no edits:

(1) β€” since C++23

/*iterator*/() = default;

(2) β€” since C++23

constexpr /*iterator*/( /*iterator*/<!Const> i )
    requires Const && (
        std::convertible_to<ranges::iterator_t<First>, ranges::iterator_t<const First>>
        && ... &&
        std::convertible_to<ranges::iterator_t<Vs>, ranges::iterator_t<const Vs>>
    );

(3) β€” private, exposition only*

private:

constexpr /*iterator*/(
    /*Parent*/& parent,
    std::tuple<ranges::iterator_t</*maybe-const*/<Const, First>>,
               ranges::iterator_t</*maybe-const*/<Const, Vs>>...>
current );

πŸ’… DESCRIPTION πŸ’…

Construct an iterator. (that's the whole vibe, honestly)

  1. Default constructor. Value-initializes the parent_ with nullptr and default-initializes the current_. lowkey simple, highkey necessary ✨.
  2. Conversion from /*iterator*/<false> to /*iterator*/<true>. Initializes parent_ with i.parent_ and current_ with std::move(i.current_). it's giving glow-up from non-const to const, slay πŸ’–.
  3. A private constructor which is used by cartesian_product_view::begin and cartesian_product_view::end. This constructor is not accessible to users. Initializes parent_ with std::addressof(parent) and current_ with std::move(current). so it's for the view's own internal use only β€” bestie, don't touch, it's not for us πŸ™ˆ.

πŸŽ€ PARAMETERS πŸŽ€

  • i β€” an /*iterator*/<false>. that's the only parameter, and it's literally the non-const iterator you're converting from. cute.

πŸ¦‹ EXAMPLE πŸ¦‹

This section is incomplete Reason: no example

(ngl, the example section is empty. they said "no example" and that's the whole tea. 😭)

⭐ CATEGORY ⭐

  • Todo no example

(yeah, it's a todo. the category is literally just "Todo no example". we love a work in progress πŸ’€)


mwah πŸ’‹ that's the page! source: http://cppreference.com, version 2024.06.10, and the page is std::ranges...or::iterator(3). stay iconic, bestie 🫢✨

πŸ“¦ where this page comes from