std::basic_...++,--,+=,-=(3)
π NAME π
okay so bestie, welcome to the C++ Standard Libary manual (yes, βLibaryβ is the spelling from the source, we are not fixing it π
). this page is std::basic_...++,--,+=,-=(3), and the main character is std::basic_const_iterator::operator++,--,+=,-=.
std::basic_const_iterator::operator++,--,+=,-= β that's the name. std::basic_const_iterator::operator++,--,+=,-= β yep, same name again. the source really said it twice and we're keeping the duplicate because every detail stays. periodt. π
πΈ Synopsis πΈ
here's the whole overload lineup, copied exactly so nobody comes for me:
constexpr basic_const_iterator& operator++(); (1)
(since C++23)
constexpr void operator++(int); (2)
(since C++23)
constexpr basic_const_iterator operator++(int) (3)
(since C++23)
requires std::forward_iterator<Iter>;
constexpr basic_const_iterator& operator--() (4)
(since C++23)
requires std::bidirectional_iterator<Iter>;
constexpr basic_const_iterator operator--(int) (5)
(since C++23)
requires std::bidirectional_iterator<Iter>;
constexpr basic_const_iterator& operator+=( difference_type n ) (6)
(since C++23)
requires std::random_access_iterator<Iter>;
constexpr basic_const_iterator& operator-=( difference_type n ) (7)
(since C++23)
requires std::random_access_iterator<Iter>;
so yeah, every one of these is since C++23, and the requires clauses are doing their little gatekeeping thing. β¨
the actual vibe: these increment or decrement the iterator by applying the corresponding operation on the underlying iterator. no cap.
- 1β3 increment by one. π
- 4,5 decrement by one. π¦
- 6,7 advance the iterator by
nor-npositions respectively. π₯
π Return value π
- 1,4,6,7 β
*this - 3,5 β a copy of
*thisthat was made before the change - 2 β
(none)
π¦ Example π¦
This section is incomplete. Reason: no example.
no example bestie π it's giving βtodoβ energy. but we move.
π See also π
operator++operator++(int)operator+=operator+β advances or decrements the iteratoroperator--β (public member function ofstd::move_iterator<Iter>)operator--(int)operator-=operator-(C++11)
π Category π
- Todo no example
mwah π β source http://cppreference.com, version/date 2024.06.10, page std::basic_...++,--,+=,-=(3). bye bestie, go increment something π«Ά
π¦ 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