[#nlohmann-swap-08]
= xref:nlohmann.adoc[nlohmann]::swap
:relfileprefix: ../
:mrdocs:

exchanges the values

== Synopsis

Declared in `&lt;nlohmann&sol;json&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
swap(
    xref:nlohmann/basic_json-05/reference.adoc[reference] left,
    xref:nlohmann/basic_json-05/reference.adoc[reference] right) noexcept(&sol;&ast; see-below &ast;&sol;);
----

== Exception specification

This function is potentially-throwing unless `std&colon;&colon;is&lowbar;nothrow&lowbar;move&lowbar;constructible&lt;value&lowbar;t&gt;&colon;&colon;value &amp;&amp; std&colon;&colon;is&lowbar;nothrow&lowbar;move&lowbar;assignable&lt;value&lowbar;t&gt;&colon;&colon;value &amp;&amp; std&colon;&colon;is&lowbar;nothrow&lowbar;move&lowbar;constructible&lt;json&lowbar;value&gt;&colon;&colon;value &amp;&amp; std&colon;&colon;is&lowbar;nothrow&lowbar;move&lowbar;assignable&lt;json&lowbar;value&gt;&colon;&colon;value`.

== Parameters

[cols="1,4"]
|===
| Name| Description
| *left*
| the type of an element reference
| *right*
| the type of an element reference
|===


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