template <class ValueType, class... Args>
void emplace(Args&&... args);
Let T be decay_t<ValueType>.
Requires: T shall satisfy the CopyConstructible requirements.
Effects: Calls reset(). Then initializes the contained value as if direct-non-list-initializing an object of type T with the arguments std::forward<Args>(args)....
Postconditions: *this contains a value.
Throws: Any exception thrown by the selected constructor of T.
Remarks: If an exception is thrown during the call to T's constructor, *this does not contain a value, and any previously contained object has been destroyed. This function shall not participate in overload resolution unless is_copy_constructible_v<T> is true and is_constructible_v<T, Args...> is true.
template <class ValueType, class U, class... Args>
void emplace(initializer_list<U> il, Args&&... args);
Let T be decay_t<ValueType>.
Requires: T shall satisfy the CopyConstructible requirements.
Effects: Calls reset(). Then initializes the contained value as if direct-non-list-initializing an object of type T with the arguments il, std::forward<Args> (args)....
Postconditions: *this contains a value.
Throws: Any exception thrown by the selected constructor of T.
Remarks: If an exception is thrown during the call to T's constructor, *this does not contain a value, and any previously contained object has been destroyed. The function shall not participate in overload resolution unless is_copy_constructible_v<T> is true and is_constructible_v<T, initializer_list<U>&, Args...> is true.
Effects: If has_value() is true, destroys the contained object.
Postconditions: has_value() is false.
Effects: Exchanges the states of *this and rhs.