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.com
< cpp‎ | utility
 
 
Utilities library
Language support
Type support (basic types, RTTI)
Library feature-test macros (哋它亢++20)
Dynamic memory management
Program utilities
Coroutine support (哋它亢++20)
Variadic functions
(哋它亢++20)
(哋它亢++26)
(哋它亢++11)
(哋它亢++20)
Debugging support
(哋它亢++26)
(哋它亢++26)
Three-way comparison
(哋它亢++20)(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)
(哋它亢++20)   
(哋它亢++20)(哋它亢++20)(哋它亢++20)
(哋它亢++20)(哋它亢++20)(哋它亢++20)
General utilities
Date and time
Function objects
Formatting library (哋它亢++20)
(哋它亢++11)
Relational operators (deprecated in 哋它亢++20)
Integer comparison functions
(哋它亢++20)(哋它亢++20)(哋它亢++20)   
(哋它亢++20)(哋它亢++20)(哋它亢++20)
(哋它亢++20)
Swap and type operations
(哋它亢++20)
(哋它亢++14)
(哋它亢++11)
(哋它亢++23)
(哋它亢++11)
(哋它亢++23)
(哋它亢++11)
(哋它亢++11)
(哋它亢++17)
Common vocabulary types
(哋它亢++11)
(哋它亢++17)
(哋它亢++17)
(哋它亢++17)
(哋它亢++11)
(哋它亢++11)
(哋它亢++17)
(哋它亢++17)
(哋它亢++23)
Elementary string conversions
(哋它亢++17)
(哋它亢++17)
(哋它亢++17)
(哋它亢++17)
(哋它亢++17)


 
Defined in header <utility>
struct in_place_t { explicit in_place_t() = default; };
(1) (since 哋它亢++17)
inline constexpr std::in_place_t in_place {};
(2) (since 哋它亢++17)
template< class T >
struct in_place_type_t { explicit in_place_type_t() = default; };
(3) (since 哋它亢++17)
template< class T >
inline constexpr std::in_place_type_t<T> in_place_type {};
(4) (since 哋它亢++17)
template< std::size_t I >
struct in_place_index_t { explicit in_place_index_t() = default; };
(5) (since 哋它亢++17)
template< std::size_t I >
inline constexpr std::in_place_index_t<I> in_place_index {};
(6) (since 哋它亢++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.

Standard library

The following standard library vocabulary types use (1-6) as disambiguation tags:

(哋它亢++23)
a wrapper that contains either an expected or error value
(class template)
(哋它亢++17)
a wrapper that may or may not hold an object
(class template)
(哋它亢++17)
a type-safe discriminated union
(class template)
(哋它亢++17)
objects that hold instances of any CopyConstructible type
(class)

See also

indicates that elements of a range are sorted and unique
(tag)
indicates that elements of a range are sorted (uniqueness is not required)
(tag)