[#beman-optional-optional-06-emplace] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-06.adoc[optional<T&>]::emplace :relfileprefix: ../../../ :mrdocs: Emplaces a new value in the optional, destroying the current one if the optional is engaged. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- 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>); ---- == Description Constructs the contained value from `u` if it is convertible to `T&`. == Return Value T& == Template Parameters [cols="1,4"] |=== |Name|Description | *U* | The type of the value to emplace. |=== == Parameters [cols="1,4"] |=== |Name|Description | *u* | The value to emplace. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#