[#beman-optional-optional-03-swap]
= xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::xref:beman/optional/optional-03.adoc[optional]::swap
:relfileprefix: ../../../
:mrdocs:

Swaps this optional with the other&period;

== Synopsis

Declared in `&lt;beman&sol;optional&sol;optional&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
void
swap(xref:beman/optional/optional-03.adoc[optional]& rhs) noexcept(std&colon;&colon;is&lowbar;nothrow&lowbar;move&lowbar;constructible&lt;T&gt;&colon;&colon;value &amp;&amp; std&colon;&colon;is&lowbar;nothrow&lowbar;swappable&lt;T&gt;&colon;&colon;value);
----

== Description

Swaps this optional with the other&period;

If neither optionals have a value, nothing happens&period; If both have a value, the values are swapped&period; If one has a value, it is moved to the other and the movee is left valueless&period;

== Parameters

[cols=2]
|===
| Name
| Description
| *rhs*
| 
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
