constexpr void swap(optional& rhs) noexcept(see below);
*this contains a value | *this does not contain a value | |||
rhs contains a value | calls swap(*(*this), *rhs) | direct-non-list-initializes the contained value of *this
with std::move(*rhs),
followed by rhs.val->T::~T();
postcondition is that *this contains a value and rhs does not contain a value | ||
rhs does not contain a value | direct-non-list-initializes the contained value of rhs
with std::move(*(*this)),
followed by val->T::~T();
postcondition is that *this does not contain a value and rhs contains a value | no effect |