std::ranges...r++,--,+=,-=(3)
π NAME π
std::ranges::adjacent_transform_view::iterator::operator++,--,+=,-= β like, the whole squad of increment/decrement/advance operators for std::ranges::adjacent_transform_view::iterator, all in one place. Yes, they all live here. It's giving "operator overload family reunion" and honestly? iconic. π
Heads up bestie, this one's from the C++ Standard Libary manpages (section 3) β that's the C++ standard library docs, and no, I did not typo "Libary", that's literally how it's spelled up top. π
β¨ Synopsis β¨
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 n ) (5) (since C++23)
requires ranges::random_access_range<Base>;
constexpr /*iterator*/& operator-=( difference_type n ) (6) (since C++23)
requires ranges::random_access_range<Base>;
So what do these bad boys do? They increment or decrement the iterator. That's the whole vibe check. πΈ
Two names you gotta know, fr fr:
- Let
inner_be the underlying iterator. - Let
Basebe the exposition-only member type.
And here's what each one is exactly equivalent to β no cap, this is the real mapping:
1) ++inner_; return *this;
2) auto tmp = *this; ++*this; return tmp;
3) --inner_; return *this;
4) auto tmp = *this; --*this; return tmp;
5) inner_ += n; return *this;
6) inner_ -= n; return *this;
Lowkey the cleanest little table of operator behaviour you'll ever see. π¦
π Parameters π
nβ position relative to current location. That's it, that's the parameter. π«Ά
π Return value π
- 1, 3, 5, 6) β
*this. The iterator itself, coming right back atcha. β¨ - 2, 4) β a copy of
*thisthat was made before the change. So like, the post-increment/post-decrement versions hand you the old you. Main character energy: they remember who you were. π
π Example π
This section is incomplete.
Reason: no example.
Not me finding an empty example section π bestie the docs said "figure it out yourself" and honestly? fair. π
π See also π
Category:
- Todo no example
(Yeah, that's the whole see-also. We're all just vibing in the todo list together. π)
β¨ that's the whole page, mwah β¨
Cute little sign-off: this was served fresh from http://cppreference.com, dated 2024.06.10, and it's page std::ranges...r++,--,+=,-=(3) of the C++ Standard Libary manpages. Go forth and increment responsibly, bestie π§π
π¦ 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