std:: projected
|
定義済みヘッダー
<iterator>
|
||
| (1) | ||
|
template
<
std::
indirectly_readable
I,
std::
indirectly_regular_unary_invocable
<
I
>
Proj
>
|
(C++20以降)
(C++26まで) |
|
|
template
<
std::
indirectly_readable
I,
std::
indirectly_regular_unary_invocable
<
I
>
Proj
>
|
(C++26以降) | |
|
template
<
std::
weakly_incrementable
I,
class
Proj
>
struct
incrementable_traits
<
std
::
projected
<
I, Proj
>>
|
(2) |
(C++20以降)
(C++26まで) |
|
ヘルパーテンプレート
|
||
|
template
<
class
I,
class
Proj
>
struct
/*projected-impl*/
|
(3) |
(C++26以降)
( 説明専用* ) |
projected
は、
indirectly_readable
型
I
と呼び出し可能オブジェクト型
Proj
を組み合わせて、新しい
indirectly_readable
型を生成します。この型の参照型は、
Proj
を
std::
iter_reference_t
<
I
>
に適用した結果です。
weakly_incrementable
型となるようにする(
I
が
weakly_incrementable
型である場合)。
projected
は、呼び出し可能オブジェクトとプロジェクションを受け入れるアルゴリズムを制約するためにのみ使用され、したがってその
operator
*
(
)
は定義されていません。
目次 |
テンプレートパラメータ
| I | - | 間接的に読み取り可能な型 |
| Proj | - |
間接参照された
I
に適用される射影
|
注記
間接レイヤーは、
I
および
Proj
が
projected
の関連クラスになることを防止します。
I
または
Proj
の関連クラスが不完全クラス型である場合、間接レイヤーはハードエラーを引き起こす型定義の不要な検査を回避します。
例
#include <algorithm> #include <cassert> #include <functional> #include <iterator> template<class T> struct Holder { T t; }; struct Incomplete; using P = Holder<Incomplete>*; static_assert(std::equality_comparable<P>); // OK static_assert(std::indirectly_comparable<P*, P*, std::equal_to<>>); // C++26以前ではエラー static_assert(std::sortable<P*>); // C++26以前ではエラー int main() { P a[10] = {}; // 10個のヌルポインタ assert(std::count(a, a + 10, nullptr) == 10); // OK assert(std::ranges::count(a, a + 10, nullptr) == 10); // C++26以前ではエラー }
関連項目
|
(C++26)
|
投影によって
indirectly_readable
型の値型を計算する
(エイリアステンプレート) |