cpp/utility/expected/operator=

Assigns a new value to an existing object.

@1,2@ Assigns the state of.
 * If equals, assigns the value contained in . Does nothing if  is (possibly cv-qualified)  and  is.
 * Otherwise, destroys the currently contained value (does nothing if is  and  is (possibly cv-qualified) ), and makes  contain a copy of the value contained in.
 * If is  and  is (possibly cv-qualified), does not construct the new value. Otherwise, the new value is copy-constructed  or move-constructed  from  or , as appropriate. If an exception is thrown, the old value is retained;  does not become valueless.

If no exception was thrown, after assignment, has_value is equal to.


 * Overload is defined as deleted unless
 * either is (possibly cv-qualified)  or  is, and
 * either is (possibly cv-qualified)  or  is, and
 * is, and
 * is, and
 * at least one of the following is :
 * is (possibly cv-qualified)
 * Overload participates in overload resolution only if
 * either is (possibly cv-qualified)  or  is, and
 * either is (possibly cv-qualified)  or  is, and
 * is, and
 * is, and
 * at least one of the following is :
 * is (possibly cv-qualified)
 * at least one of the following is :
 * is (possibly cv-qualified)

@3@ Assigns from expected value. If no exception was thrown, after assignment, is. @4,5@ Assigns from unexpected value. Let be  for overload, and  for overload. If no exception was thrown, after assignment, is false.
 * If is, equivalent to.
 * Otherwise, destroys the value contained in, and makes contain a value initialized from . If an exception is thrown, the old value is retained;  does not become valueless.
 * If is, destroys the value contained in  (does nothing if  is (possibly cv-qualified) ), and makes  contain a value initialized from . If an exception is thrown, the old value is retained;  does not become valueless.
 * Otherwise, equivalent to.

In all cases, if is not (possibly cv-qualified), the destruction of old value and construction of new value is performed as if by the following exposition-only function.

Exceptions
@1@ Throws any exception thrown by the copy constructor or copy assignment operator of or. @2@ If is (possibly cv-qualified) , Otherwise, @3@ Throws any exception thrown by the constructor or assignment operator of. @4,5@ Throws any exception thrown by the constructor or assignment operator of.