std::ranges::concat_view<Views...>::iterator
template< bool Const >
class /*iterator*/
|
(1) | (説明専用*) |
| ヘルパーコンセプト |
||
template< bool Const, class... Rs >
concept /*concat-is-random-access*/ = /* see description */;
|
(2) | (説明専用*) |
template< bool Const, class... Rs >
concept /*concat-is-bidirectional*/ = /* see description */;
|
(3) | (説明専用*) |
ranges::concat_view<Views...>::iterator は、 によって返されるイテレータの型です begin() および end() の ranges::concat_view<Views...>。Fs を Rs のすべての要素からなるパックとする template<bool Const, class... Rs>
concept concat-is-random-access = // exposition only
all-random-access <Const, Rs...> &&
(ranges::common_range<maybe-const <Const, Fs>> && ...);
Fs Rs のすべての要素からなるパックとする template<bool Const, class... Rs>
concept concat-is-bidirectional = // exposition only
all-bidirectional <Const, Rs...> &&
(ranges::common_range<maybe-const <Const, Fs>> && ...);
テンプレートパラメータ
| Const | - | イテレータが定数イテレータかどうか |
ネスト型
説明専用型 |
|
| 型 | 定義 |
base-iter
|
std::
variant
<
ranges::
iterator_t
<
maybe-const
<
Const, Views
>>
...
>
( 説明専用メンバ型* ) |
イテレータプロパティ型 |
|
| 型 | 定義 |
iterator_concept
|
イテレータタグ , 下記参照 |
iterator_category
(条件付きで存在) |
イテレータタグ, 下記参照 |
value_type
|
concat-value-t
<
maybe-const
<
Const, Views
>
...
>
|
difference_type
|
std::
common_type_t
<
ranges::
range_difference_t
<
|
イテレータコンセプトの決定
iterator_concept
は以下のように定義されます:
-
concat-is-random-access < Const, Views... > がモデル化されている場合、iterator_conceptは std::random_access_iterator_tag を示す。 -
それ以外の場合、
concat-is-bidirectional < Const, Views... > がモデル化されている場合、iterator_conceptは std::bidirectional_iterator_tag を示す。 -
それ以外の場合、
all-forward < Const, Views... > がモデル化されている場合、iterator_conceptは std::forward_iterator_tag を示す。 -
それ以外の場合、
iterator_conceptは std::input_iterator_tag を示す。
イテレータカテゴリの判定
iterator_category
は、
all-forward
<
Const, Views...
>
がモデル化されている場合にのみ定義されます。この場合、以下のように定義されます:
-
std::
is_reference_v
<
concat-reference-t <maybe-const < Const, Views > ... >> が false の場合、iterator_categoryは std::input_iterator_tag を示す。 -
それ以外の場合、
Csを型のパック std:: iterator_traits < ranges:: iterator_t <maybe-const < Const, Views >>> :: iterator_category ... とする:-
(
std::
derived_from
<
Cs,
std::
random_access_iterator_tag
>
&&
...
)
&&
concat-is-random-access < Const, Views... > が true の場合、iterator_categoryは std::random_access_iterator_tag を示す。 -
それ以外で、
(
std::
derived_from
<
Cs,
std::
bidirectional_iterator_tag
>
&&
...
)
&&
concat-is-bidirectional < Const, Views... > が true の場合、iterator_categoryは std::bidirectional_iterator_tag を示す。 -
それ以外で、
(
std::
derived_from
<
Cs,
std::
forward_iterator_tag
>
&&
...
)
が
true
の場合、
iterator_categoryは std::forward_iterator_tag を示す。 -
それ以外の場合、
iterator_categoryは std::input_iterator_tag を示す。
-
(
std::
derived_from
<
Cs,
std::
random_access_iterator_tag
>
&&
...
)
&&
データメンバ
| メンバ | 説明 |
maybe-const <Const, ranges::concat_view>* parent_
|
親へのポインタ concat_view(説明専用メンバオブジェクト*) |
base-iter it_
|
現在のビューへのイテレータ (説明専用メンバオブジェクト*) |
メンバー関数
|
イテレータを構築する
(public member function) |
|
|
要素にアクセスする
(public member function) |
|
|
インデックスによる要素へのアクセス
(public member function) |
|
|
基盤となるイテレータを進める、または戻す
(public member function) |
|
Exposition-only 関数テンプレート |
|
it_
が現在のビューの終端である場合、次のビューの先頭で置き換える
( exposition-only member function* ) |
|
it_
を前の位置を指すようにデクリメントする
( exposition-only member function* ) |
|
|
指定されたオフセット分だけ現在位置を進める
( exposition-only member function* ) |
|
|
指定された値分だけ現在位置をデクリメントする
( exposition-only member function* ) |
|
非メンバー関数
|
基底となるイテレータを比較する
(関数) |
|
|
(C++26)
|
イテレータ演算を実行する
(関数) |
|
(C++26)
|
基底となるイテレータの間接参照結果を、関連する右辺値参照型にキャストする
(関数) |
|
(C++26)
|
2つの基底となるイテレータが指すオブジェクトを交換する
(関数) |
例
プレビュー版は Compiler Explorer で確認できます。
#include <iostream> #include <iterator> #include <ranges> int main() { namespace views = std::views; static constexpr int p[]{1, 2, 3}; static constexpr auto e = {4, 5}; auto t = views::iota(6, 9); auto cat = views::concat(p, e, t); auto dog = views::concat(cat, cat); for (auto i{dog.begin()}; i != std::default_sentinel; ++i) std::cout << *i << ' '; std::cout << '\n'; }
出力:
1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8
参考文献
- C++26標準 (ISO/IEC 14882:2026):
-
-
26.7.18.3 クラステンプレート
concat_view::iterator[range.concat.iterator]
-
26.7.18.3 クラステンプレート