[#BloombergLP-bdljsn-swap-04]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::swap
:relfileprefix: ../../
:mrdocs:

Exchange the values of the specified `a` and `b` objects&period;

== Synopsis

Declared in `&lt;bdljsn&lowbar;json&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
swap(
    xref:BloombergLP/bdljsn/Json.adoc[Json]& a,
    xref:BloombergLP/bdljsn/Json.adoc[Json]& b);
----

== Description

Exchange the value of the specified `a` `Json` object with that of the specified `b` `Json` object&period; If an exception is thrown, both objects are left in valid but unspecified states&period; This operation guarantees O&lsqb;1&rsqb; complexity&period; The behavior is undefined unless `a` was created with the same allocator as `b`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *a*
| first object
| *b*
| second object
|===


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