Emplaces a new value in the optional, destroying the current one if the optional is engaged.
<beman/optional/optional.hpp>
template<class U>
requires (std::is_constructible_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, U>)
constexpr
T&
emplace(U&& u) noexcept(std::is_nothrow_constructible_v<T &, U>);
Constructs the contained value from u if it is convertible to T&.
| Name | Description |
|---|---|
| U | The type of the value to emplace. |
| Name | Description |
|---|---|
| u | The value to emplace. |