std::ranges...++,--,+=,-=(3)
π std::ranges...++,--,+=,-=(3) π
okay bestie, welcome to the C++ Standard Libary manual page for std::ranges::enumerate_view::iterator::operator++,--,+=,-=. Yes, the title is a whole keyboard smash and we are obsessed. This page is literally about std::ranges::enumerate_view::iterator::operator++,--,+=,-=. Slay.
π NAME π
std::ranges::enumerate_view::iterator::operator++,--,+=,-=β the full NAME entry is this exact gorgeous mouthful, and the description line is the same exact gorgeous mouthful:std::ranges::enumerate_view::iterator::operator++,--,+=,-=. No notes. π
πΈ Synopsis πΈ
Here's the numbered cast, all since C++23, bestie:
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<Base>;
constexpr /*iterator*/& operator--() (4) (since C++23)
requires ranges::bidirectional_range<Base>;
constexpr /*iterator*/ operator--( int ) (5) (since C++23)
requires ranges::bidirectional_range<Base>;
constexpr /*iterator*/& operator+=( difference_type n ) (6) (since C++23)
requires ranges::random_access_range<Base>;
constexpr /*iterator*/& operator-=( difference_type n ) (7) (since C++23)
requires ranges::random_access_range<Base>;
Increments or decrements the iterator. That's the whole job, and it ate. π
Tiny vocab check: current_ is the underlying iterator, and pos_ is the underlying index. Now the receipts:
- (1) Equivalent to
++current_; ++pos_; return *this; - (2) Equivalent to
++current_; - (3) Equivalent to
auto tmp = *this; ++*this; return tmp; - (4) Equivalent to
--current_; --pos_; return *this; - (5) Equivalent to
auto tmp = *this; --*this; return tmp; - (6) Equivalent to
current_ += n; pos_ += n; return *this; - (7) Equivalent to
current_ -= n; pos_ -= n; return *this;
π Parameters π
nβ position relative to current location. That's the parameter, bestie. π«Ά
β¨ Return value β¨
1,4,6,7)β*this2)β (none)3,5)β a copy of*thisthat was made before the change
π¦ See also π¦
operator+performs iterator arithmeticoperator-(function) β(C++23)
and that's the page, bestie π
source/version + date from the footer: http://cppreference.com Β· 2024.06.10. periodt. π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms