[#beman-optional-optional-06-2constructor-05] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-06.adoc[optional<T&>]::optional :relfileprefix: ../../../ :mrdocs: Constructs an optional from another optional of type U. == Synopsis Declared in `<beman/optional/optional.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class U> requires (std::is_constructible_v<T&, const U> && !std::is_same_v<std::remove_cv_t<T>, optional<U>> && !std::is_same_v<T&, U> && !detail::reference_constructs_from_temporary_v<T&, const U>) constexpr explicit(!std::is_convertible_v<const U, T &>) optional(xref:beman/optional/optional-03.adoc[optional<U>] const&& rhs) noexcept(noexcept(std::is_nothrow_constructible_v<T &, const U>)); ---- == Description Constructs the stored value from the rhs if it has a value, otherwise constructs an empty optional. 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]#