std::ranges...++,--,+=,-=(3)
π NAME π
This is the std::ranges...++,--,+=,-=(3) page from the C++ Standard Libary manual β yes, bestie, thatβs the manual name as printed in the header, typo and all, and weβre keeping it because details are sacred. Itβs the cppreference C++ Standard Library page all about std::ranges::chunk_view::iterator::operator++,--,+=,-=. The original NAME section lists std::ranges::chunk_view::iterator::operator++,--,+=,-= twice, so hereβs the second mention too: std::ranges::chunk_view::iterator::operator++,--,+=,-=. Double name, double slay, no skipping π
β¨ Synopsis β¨
Every single one of these is (since C++23) β C++23 girlies rise:
constexpr /*iterator*/& operator++(); (1) (since C++23)
constexpr /*iterator*/ operator++( int ); (2) (since C++23)
constexpr /*iterator*/& operator--() (3) (since C++23)
requires ranges::bidirectional_range<Base>;
constexpr /*iterator*/ operator--( int ) (4) (since C++23)
requires ranges::bidirectional_range<Base>;
constexpr /*iterator*/& operator+=( difference_type x ) (5) (since C++23)
requires ranges::random_access_range<Base>;
constexpr /*iterator*/& operator-=( difference_type x ) (6) (since C++23)
requires ranges::random_access_range<Base>;
Advances or decrements the iterator.
Let current_, end_, and n_ be the underlying data members of chunk_view::iterator.
- Equivalent to:
missing_ = ranges::advance(current_, n_, end_);
return *this;
Before the invocation the expression current_ != end_ must be true, otherwise the behavior is undefined. π¨
- Equivalent to:
auto tmp = *this; ++*this; return tmp;. - Equivalent to:
ranges::advance(current_, missing_ - n_);
missing_ = 0;
return *this;
- Equivalent to:
auto tmp = *this; --*this; return tmp;. - Equivalent to:
if (x > 0)
{
ranges::advance(current_, n_ * (x - 1));
missing_ = ranges::advance(current_, n_, end_);
}
else if (x < 0)
{
ranges::advance(current_, n_ * x + missing_);
missing_ = 0;
}
return *this;
If x is positive, then before the invocation the expression ranges::distance(current_, end_) > n_ * (x - 1) must be true (i.e., informally, the requested chunk should be "inside" the underlying sequence). If x is negative, this precondition is always met.
- Equivalent to:
return *this += -x;.
πΈ Parameters πΈ
xβ a position relative to current location π
π Return value π
- 1,3,5,6) β
*this - 2,4) β a copy of
*thisthat was made before the change
π¦ Example π¦
This section is incomplete. Reason: no example. π
π See also π
operator+performs iterator arithmeticoperator-(function) (C++23)
π·οΈ Category: π·οΈ
- Todo no example
Signed off with all the love and C++23 sparkles: source/version http://cppreference.com, date 2024.06.10 β muah πβ¨
π¦ 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