void swap( optional& other );
Swaps the contents with those of
- If none of *this and
otherare in engaged states, the function has no effect.
- If only one of *this and
otheris in engaged state (let's call this object
inand the other
un), the contained value of
unis initialized by moving the contained value of
in, followed by destruction of the contained value of
inis in disengaged state and
unis in engaged state afterwards.
- If both *this and
otherhave engaged states, the contained values are exchanged by calling swap(**this, *other).
|other||-|| the |
 Return value
In the case of thrown exception, the states of the contained values of *this and
other are determined by the exception safety guarantees of
swap of type
T's move constructor, whichever is called. For both *this and
other, if the object was in engaged state, it is left in engaged state, and the other way round.
 See also
| specializes the std::swap algorithm |