std::ranges...++,--,+=,-=(3)

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

πŸ’… std::ranges...++,--,+=,-=(3) πŸ’…

Okay bestie, welcome to the C++ Standard Libary manual πŸ’–. This page is literally std::ranges...++,--,+=,-=(3), and it's all about the std::ranges::cartesian_product_view::iterator operators ++, --, +=, and -=. The way that's a whole mouthful β€” slay, but also hydrate. 🫢

πŸ’– NAME πŸ’–

std::ranges::cartesian_product_view::iterator::operator++,--,+=,-= β€” yes, that's the name, and the page says it again: std::ranges::cartesian_product_view::iterator::operator++,--,+=,-=. Repetition is the main character energy here. πŸ‘‘

✨ Synopsis ✨

          constexpr /*iterator*/& operator++();
       (1) (since C++23)
          constexpr void operator++( int );
       (2) (since C++23)
          constexpr /*iterator*/ operator++( int )
       (3) (since C++23)
            requires ranges::forward_range</*maybe-const*/<Const, First>>;
          constexpr /*iterator*/& operator--()
            requires /*cartesian-product-is-bidirectional*/<Const, First,
       (4) (since C++23)
          Vs...>;
          constexpr /*iterator*/ operator--( int )
            requires /*cartesian-product-is-bidirectional*/<Const, First,
       (5) (since C++23)
          Vs...>;
          constexpr /*iterator*/& operator+=( difference_type n )
            requires /*cartesian-product-is-random-access*/<Const, First,
       (6) (since C++23)
          Vs...>;
          constexpr /*iterator*/& operator-=( difference_type n )
            requires /*cartesian-product-is-random-access*/<Const, First,
       (7) (since C++23)
          Vs...>;

Increments or decrements the iterator. Let current_ denote the underlying tuple of iterators and parent_ denote the underlying pointer to cartesian_product_view. No cap. 🌸

  1. (1) Equivalent to next(); return *this;
  2. (2) Equivalent to ++*this;
  3. (3) Equivalent to auto tmp = *this; ++*this; return tmp;
  4. (4) Equivalent to prev(); return *this;
  5. (5) Equivalent to auto tmp = *this; --*this; return tmp;
  6. (6) Sets the value of *this to ret, where ret is:
    • if n > 0, the value of *this provided that next been called n times. Otherwise,
    • if n < 0, the value of *this provided that prev been called -n times. Otherwise,
    • the value of *this before the call.
⚠️ Undefined behavior for (6): the behavior is undefined if n is not in the range [ranges::distance(*this, ranges::begin(*parent_)), ranges::distance(*this, ranges::end(*parent_))). Like, do not play with that, bestie. πŸ’€
  1. (7) Equivalent to *this += -n; return *this;.

πŸŽ€ Parameters πŸŽ€

  • n β€” position relative to current location.

🌈 Return value 🌈

  • 1,4,6,7) β€” *this
  • 2) β€” (none)
  • 3,5) β€” a copy of *this that was made before the change.

πŸ”₯ Complexity πŸ”₯

  • 6) β€” Constant. Short and sweet, periodt.

🌸 Example 🌸

This section is incomplete.

Reason: no example.

πŸ¦‹ See also πŸ¦‹

  • operator+ performs iterator arithmetic
  • operator- (function)
  • (C++23)

🏷️ Category:

  • Todo no example

πŸ’Œ Source/version check: http://cppreference.com, dated 2024.06.10. Byeee, go slay those iterators 🫢✨

πŸ“¦ where this page comes from