constexpr optional<T>& operator=(nullopt_t) noexcept;
constexpr optional<T>& operator=(const optional& rhs);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns *rhs to the contained value | direct-non-list-initializes the contained value with *rhs | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
constexpr optional& operator=(optional&& rhs) noexcept(see below);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns std::move(*rhs) to the contained value | direct-non-list-initializes the contained value with std::move(*rhs) | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
template<class U = T> constexpr optional<T>& operator=(U&& v);
template<class U> constexpr optional<T>& operator=(const optional<U>& rhs);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns *rhs to the contained value | direct-non-list-initializes the contained value with *rhs | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
template<class U> constexpr optional<T>& operator=(optional<U>&& rhs);
*this contains a value | *this does not contain a value | |||
rhs contains a value | assigns std::move(*rhs) to the contained value | direct-non-list-initializes the contained value with std::move(*rhs) | ||
rhs does not contain a value | destroys the contained value by calling val->T::~T() | no effect |
template<class... Args> constexpr T& emplace(Args&&... args);
template<class U, class... Args> constexpr T& emplace(initializer_list<U> il, Args&&... args);