std::ranges...erator++,--(3)
π NAME π
std::ranges::join_with_view::iterator::operator++,-- β aka std::ranges::join_with_view::iterator::operator++,--. We're in the C++ Standard Libary manual, section 3, bestie, and this page is all about the increment and decrement operators. π
β¨ Synopsis β¨
constexpr /*iterator*/& operator++(); (1) (since
C++23)
constexpr void operator++( int ); (2) (since
C++23)
constexpr /*iterator*/ operator++( int )
requires std::is_reference_v<InnerBase> && (3) (since
C++23)
ranges::forward_range<Base> &&
ranges::forward_range<InnerBase>;
constexpr /*iterator*/& operator--()
requires std::is_reference_v<InnerBase> &&
ranges::bidirectional_range<Base> &&
ranges::bidirectional_range<InnerBase> && (4) (since
C++23)
ranges::common_range<InnerBase> &&
ranges::bidirectional_range<PatternBase> &&
ranges::common_range<PatternBase>;
constexpr /*iterator*/ operator--( int )
requires std::is_reference_v<InnerBase> &&
ranges::bidirectional_range<Base> &&
ranges::bidirectional_range<InnerBase> && (5) (since
C++23)
ranges::common_range<InnerBase> &&
ranges::bidirectional_range<PatternBase> &&
ranges::common_range<PatternBase>;
All of these overloads are since C++23, periodt. The requires-clauses are doing a lot, so read them like your faveβs outfit details: every line matters. π
Okay so, real talk: this whole page is literally about incrementing or decrementing the iterator. Hereβs the overload-by-overload tea, no cap:
- (1)
operator++()increments the stored inner iterator. That inner iterator may point to eitherInnerBaseorPatternBaseβ iykyk.- If the incremented inner iterator reaches the end of the pattern range, it is destroyed, and an iterator to the beginning of the next inner range is constructed. π«Ά
- If the incremented inner iterator reaches the end of the inner range, the outer iterator is incremented, and if the outer iterator is not the end iterator, the inner iterator is destroyed and an iterator to the beginning of the pattern range is constructed.
- The above steps may be repeated (e.g. if the pattern is empty), until either the inner range is not empty, or the outer iterator reaches the end. Slay.
- (2)
operator++( int )is equivalent to++*this; - (3)
operator++( int )is equivalent toauto tmp = *this; ++*this; return tmp; - (4)
operator--(): If the outer iterator is the end iterator, it is decremented. Then:- If the stored inner iterator refers to the beginning of the inner range, it is destroyed, and an iterator to the end of the pattern range is constructed.
- If the stored inner iterator refers to the beginning of the pattern range, it is destroyed, the outer iterator is decremented, and an iterator to end of the inner range is constructed.
- The above steps may be repeated (e.g. if the pattern is empty), until the inner range is not empty.
Finally, the inner iterator is decremented. π
- (5)
operator--( int )is equivalent toauto tmp = *this; --*this; return tmp;
If InnerBase is not a reference, the inner range is stored in the parent join_with_view for iteration. The inner range need not be movable. Lowkey important.
If InnerBase is a reference, and the outer iterator reaches the end, the inner iterator points to the beginning of the pattern range. Thatβs the rule, fr fr.
π«Ά Parameters π«Ά
(none) β literally none, bestie.
π Return value π
1,4)*this3,5)A copy of*thisthat was made before the change.
Okay thatβs the whole page, bestie. Source/version shoutout: http://cppreference.com; date: 2024.06.10. Mwah πβ¨
π¦ 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