Remarks:
The expression inside
noexcept is equivalent to:
is_nothrow_move_constructible_v<T> && is_nothrow_swappable_v<T>
If any exception is thrown, the results of the expressions
bool(*this) and
bool(rhs) remain unchanged
. If an exception is thrown during the call to function
swap,
the state of
*val and
*rhs.val is determined by the exception safety guarantee of
swap for lvalues of
T. If an exception is thrown during the call to
T's move constructor,
the state of
*val and
*rhs.val is determined by the exception safety guarantee of
T's move constructor
.