std:: in_place, std:: in_place_type, std:: in_place_index, std:: in_place_t, std:: in_place_type_t, std:: in_place_index_t
From cppreference.net
|
定義済みヘッダー
<utility>
|
||
|
struct
in_place_t
{
explicit
in_place_t
(
)
=
default
;
}
;
|
(1) | (C++17以降) |
|
inline
constexpr
std
::
in_place_t
in_place
{
}
;
|
(2) | (C++17以降) |
|
template
<
class
T
>
struct in_place_type_t { explicit in_place_type_t ( ) = default ; } ; |
(3) | (C++17以降) |
|
template
<
class
T
>
constexpr std :: in_place_type_t < T > in_place_type { } ; |
(4) | (C++17以降) |
|
template
<
std::
size_t
I
>
struct in_place_index_t { explicit in_place_index_t ( ) = default ; } ; |
(5) | (C++17以降) |
|
template
<
std::
size_t
I
>
constexpr std :: in_place_index_t < I > in_place_index { } ; |
(6) | (C++17以降) |
1,3,5)
型/型テンプレート
std::in_place_t
、
std::in_place_type_t
および
std::in_place_index_t
は、コンストラクタのパラメータリストで意図したタグをマッチさせるために使用できます。
2,4,6)
対応する
std::in_place
、
std::in_place_type
、および
std::in_place_index
の
(1,3,5)
インスタンスは、包含オブジェクトがその場で構築されるべきであること、および(後者2つについては)構築されるオブジェクトの型を示すためにコンストラクタに渡すことができる曖昧性解消タグです。
標準ライブラリ
以下の標準ライブラリ型は (1-6) を曖昧性除去タグとして使用します:
|
(C++17)
|
任意の
CopyConstructible
型のインスタンスを保持するオブジェクト
(クラス) |
|
(C++23)
|
期待値またはエラー値のいずれかを含むラッパー
(クラステンプレート) |
|
(C++23)
|
特定の呼び出しシグネチャにおける修飾子をサポートする任意の呼び出し可能オブジェクトのムーブ専用ラッパー
(クラステンプレート) |
|
(C++17)
|
オブジェクトを保持する場合と保持しない場合があるラッパー
(クラステンプレート) |
|
(C++17)
|
型安全な判別共用体
(クラステンプレート) |
関連項目
|
(C++23)
|
範囲の要素がソート済みで一意であることを示す
(タグ) |
|
範囲の要素がソート済みであることを示す(一意性は不要)
(タグ) |