| T is not cv void | ||
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) |
| T is cv void | ||
constexpr void emplace() noexcept; | (3) | (since C++23) |
Constructs an expected value in-place. After the call, has_value() returns true.
*this as if by direct-initializing an object of type T from the arguments std::forward<Args>(args).... This overload participates in overload resolution only if std::is_nothrow_constructible_v<T, Args...> is true.*this as if by direct-initializing an object of type T from the arguments il, std::forward<Args>(args).... This overload participates in overload resolution only if std::is_nothrow_constructible_v<T, std::initializer_list<U>&, Args...> is true.*this contains an unexpected value, destroys that value.| args... | - | the arguments to pass to the constructor |
| il | - | the initializer list to pass to the constructor |
A reference to the new contained value.
noexcept specification: noexceptIf the construction of T is potentially-throwing, this function is not defined. In this case, it is the responsibility of the user to create a temporary and move or copy it.
|
(C++23) | assigns contents (public member function) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/utility/expected/emplace