| Technical Specification | ||||
| Filesystem library(filesystem TS) | ||||
| Library fundamentals(library fundamentals TS) | ||||
| Library fundamentals 2(library fundamentals TS v2) | ||||
| Library fundamentals 3(library fundamentals TS v3) | ||||
| Extensions for parallelism(parallelism TS) | ||||
| Extensions for parallelism 2(parallelism TS v2) | ||||
| Extensions for concurrency(concurrency TS) | ||||
| Extensions for concurrency 2(concurrency TS v2) | ||||
| Concepts(concepts TS) | ||||
| Ranges(ranges TS) | ||||
| Reflection(reflection TS) | ||||
| Mathematical special functions(special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
| Member functions | ||||
| Observers | ||||
| Modifiers | ||||
optional::swap | ||||
| Non-member functions | ||||
| Helper classes | ||||
| Helper objects | ||||
void swap( optional& other)noexcept(/* see below */); | (library fundamentals TS) | |
Swaps the contents with those ofother.
in and the otherun), the contained value ofun isdirect-initialized fromstd::move(*in), followed by destruction of the contained value ofin as if byin.val->T::~T(). After this call,in does not contain a valueun contains a value.T lvalues must satisfySwappable.Contents |
| other | - | theoptional object to exchange the contents with |
(none)
In the case of thrown exception, the states of the contained values of*this andother are determined by the exception safety guarantees ofswap of typeT orT's move constructor, whichever is called. For both*this andother, if the object contained a value, it is left containing a value, and the other way round.
| specializes thestd::swap algorithm (function)[edit] |