std::experimental::optional::swap - cppreference.com (original) (raw)

| void swap( optional& other ) noexcept(/* see below */); | | (library fundamentals TS) | | --------------------------------------------------------- | | ------------------------- |

Swaps the contents with those of other.

[edit] Parameters

other - the optional object to exchange the contents with

[edit] Return value

(none)

[edit] Exceptions

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 or T's move constructor, whichever is called. For both *this and other, if the object contained a value, it is left containing a value, and the other way round.

[edit] See also