[#beman-optional-optional-06-2constructor-01a] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-06.adoc[optional<T&>]::optional :relfileprefix: ../../../ :mrdocs: Construct from a U == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, U> && !(std::is_same_v<std::remove_cvref_t<U>, in_place_t>) && !(std::is_same_v<std::remove_cvref_t<U>, optional>) && !detail::reference_constructs_from_temporary_v<T&, U>) constexpr explicit(!std::is_convertible_v<U, T &>) optional(U&& u) noexcept(std::is_nothrow_constructible_v<T &, U>); ---- == Description Constructs the stored value from `u` if it is convertible to `T&`. If `T&` can be constructed from a temporary, this constructor is deleted to prevent binding a temporary to a reference. [.small]#Created with https://www.mrdocs.com[MrDocs]#