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

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

✨ NAME ✨

okay bestie, welcome to the std::ranges...r++,--,+=,-=(3) page from the C++ Standard Libary manual πŸ’… (yes, that’s the manual name on the page, we’re keeping it cute and accurate 🫢).

The actual name is literally:

std::ranges::elements_view::iterator::operator++,--,+=,-= - std::ranges::elements_view::iterator::operator++,--,+=,-=


✨ Synopsis ✨

here’s the whole overload lineup, no cap 🌈:

constexpr /*iterator*/& operator++();                   (1) (since C++20)
constexpr void operator++( int );                       (2) (since C++20)
constexpr /*iterator*/ operator++( int )                (3) (since C++20)
  requires ranges::forward_range<Base>;
constexpr /*iterator*/& operator--()                    (4) (since C++20)
  requires ranges::bidirectional_range<Base>;
constexpr /*iterator*/ operator--( int )                (5) (since C++20)
  requires ranges::bidirectional_range<Base>;
constexpr /*iterator*/& operator+=( difference_type n ) (6) (since C++20)
  requires ranges::random_access_range<Base>;
constexpr /*iterator*/& operator-=( difference_type n ) (7) (since C++20)
  requires ranges::random_access_range<Base>;

Increments or decrements the iterator. Let current_ be the underlying iterator. πŸ¦‹

  1. Equivalent to ++current_; return *this;
  2. Equivalent to ++current_;
  3. Equivalent to auto tmp = *this; ++*this; return tmp;
  4. Equivalent to --current_; return *this;
  5. Equivalent to auto tmp = *this; --*this; return tmp;
  6. Equivalent to current_ += n; return *this;
  7. Equivalent to current_ -= 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

that’s the whole vibe, bestie 🫢 source/version and date on the page: http://cppreference.com β€” 2024.06.10 ✨

πŸ“¦ where this page comes from