cpp/utility/variant/swap

Swaps two objects.


 * if both and  are valueless by exception, does nothing
 * otherwise, if both and  hold the same alternative, calls  where  is . If an exception is thrown, the state of the values depends on the exception safety of the swap function called.
 * otherwise, exchanges values of and . If an exception is thrown, the state of  and  depends on exception safety of variant's move constructor.

The behavior is undefined unless lvalues of type are  and  is  for all  in.

Return value
(none)

Exceptions
If, may throw any exception thrown by with  being.

Otherwise, may throw any exception thrown by the move constructors of the alternatives currently held by and.