|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Primary template | ||
template<class...Args> constexpr T& emplace( Args&&...args)noexcept; | (1) | (since C++23) |
template<class U,class...Args> constexpr T& emplace(std::initializer_list<U> il, Args&&...args)noexcept; | (2) | (since C++23) |
void partial specialization | ||
constexprvoid emplace()noexcept; | (3) | (since C++23) |
Constructs an expected value in-place. After the call,has_value() returns true.
Contents |
| args | - | the arguments to pass to the constructor |
| il | - | the initializer list to pass to the constructor |
val),std::forward<Args>(args)...)val), il,std::forward<Args>(args)...)If the construction ofT is potentially-throwing,operator= can be used instead.
| This section is incomplete Reason: no example |
| assigns contents (public member function)[edit] |