Constructs an optional from another optional of type U
Synopsis
Declared in <beman/optional/optional.hpp>
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
optional(optional<U> const& rhs) = delete;
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.
Template Parameters
Name |
Description |
U |
Parameters
Name |
Description |
rhs |
Created with MrDocs