std::ranges::join_with_view<V,Pattern>::iterator<Const>::operator++,--
From cppreference.com
< cpp | ranges | join with view | iterator
| constexpr /*iterator*/& operator++(); |
(1) | (C++23から) |
| constexpr void operator++( int ); |
(2) | (C++23から) |
| constexpr /*iterator*/ operator++( int ) requires std::is_reference_v</*InnerBase*/> && |
(3) | (C++23から) |
| constexpr /*iterator*/& operator--() requires std::is_reference_v</*InnerBase*/> && |
(4) | (C++23から) |
| constexpr /*iterator*/ operator--( int ) requires std::is_reference_v</*InnerBase*/> && |
(5) | (C++23から) |
イテレータをインクリメントまたはデクリメントします。
1) 内側のイテレータを std::visit([](auto& it){ ++it; },
inner_it_ );のようにインクリメントします。 その後、内側と外側のイテレータを次のように調整します。
- インクリメントされた内側イテレータがパターン範囲の終端(past-the-end)イテレータである場合、次の内側範囲の先頭へのイテレータに設定されます。
- インクリメントされた内側イテレータが内側範囲の終端(past-the-end)イテレータである場合、外側イテレータがインクリメントされます。その後、
- インクリメントされた外側イテレータが外側範囲の終端(past-the-end)イテレータでない場合、内側イテレータはパターン範囲の先頭へのイテレータに設定されます。
- そうでなければ、std::is_reference_v<
InnerBase> が true である場合、内側イテレータは 特異値(singular value) を保持するパターンイテレータに設定されます。
- 内側イテレータが終端(past-the-end)イテレータでなく、または外側イテレータが終端(past-the-end)イテレータになるまで、上記の操作を繰り返します。
2) ++*this;と同等です。
3) auto tmp = *this;
++*this;
return tmp; と同等です。
++*this;
return tmp; と同等です。
4) 外側イテレータが外側範囲の終端(past-the-end)イテレータである場合、それをデクリメントし、内側イテレータを最後の内側範囲の終端(past-the-end)イテレータに設定します。そうでなければ、何も行いません。
その後、内側と外側のイテレータを次のように調整します。
- 内側イテレータが内側範囲の先頭を参照している場合、パターン範囲の終端(past-the-end)イテレータに設定されます。
- 内側イテレータがパターン範囲の先頭を参照している場合、外側イテレータがデクリメントされ、内側イテレータは前の内側範囲の終端(past-the-end)イテレータに設定されます。
- 内側イテレータがいずれかの範囲の先頭を参照しなくなるまで、上記の操作を繰り返します。
最後に、内側イテレータを std::visit([](auto& it){ --it; },
inner_it_ );のようにデクリメントします。5) auto tmp = *this;
--*this;
return tmp; と同等です。
--*this;
return tmp; と同等です。
[編集] 戻り値
1,4) *this
3,5) 変更前になされた *this のコピー。