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

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

🌟 std::ranges::transform_view::iterator::operator++,--,+=,-= 🌟

okay so bestie, this is from the C++ Standard Libary, man page (3), and it's literally the transform_view iterator's whole ++, --, +=, -= era. The NAME is a mouthful and the original hits you with it twice β€” dash in the middle and everything. No cap, it's giving iterator arithmetic main character energy πŸ’….

✨ NAME ✨

  • std::ranges::transform_view::iterator::operator++,--,+=,-= β€” that's the name, exactly. The original NAME line repeats it twice with a dash between: std::ranges::transform_view::iterator::operator++,--,+=,-= - std::ranges::transform_view::iterator::operator++,--,+=,-=.

πŸ’… Synopsis πŸ’…

here's the overload lineup, and every single one is since C++20, bestie:

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. Here's the exact equivalences, no additions from me:

  • 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
  • 3,5) β€” a copy of *this that was made before the change
bestie note: that Return value list is exactly what the page says β€” 2 is not listed there, so I'm not inventing anything. periodt 🫢

okay bestie, that's the whole (3) page πŸ’– source: http://cppreference.com, version/date: 2024.06.10, and the footer title is literally std::ranges...++,--,+=,-=(3). slay ✨

πŸ“¦ where this page comes from