On this page
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
Defined in header <utility> |
||
---|---|---|
|
(1) | (since C++17) |
|
(2) | (since C++17) |
|
(3) | (since C++17) |
|
(4) | (since C++17) |
|
(5) | (since C++17) |
|
(6) | (since C++17) |
1,3,5) The type/type templates
std::in_place_t
, std::in_place_type_t
and std::in_place_index_t
can be used in the constructor's parameter list to match the intended tag.
2,4,6) The corresponding
std::in_place
, std::in_place_type
, and std::in_place_index
instances of (1,3,5) are disambiguation tags that can be passed to the constructors of std::expected
, std::optional
, std::variant
, and std::any
to indicate that the contained object should be constructed in-place, and (for the latter two) the type of the object to be constructed.
See also
(C++23)
|
a wrapper that contains either an expected or error value (class template) |
(C++17)
|
a wrapper that may or may not hold an object (class template) |
(C++17)
|
a type-safe discriminated union (class template) |
(C++17)
|
objects that hold instances of any CopyConstructible type (class) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/utility/in_place