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

`swap` overloads

== Synopses

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

Exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise&period;


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

[.small]#xref:BloombergLP/bdljsn/swap-0d.adoc[_» more&period;&period;&period;_]#

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;


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

[.small]#xref:BloombergLP/bdljsn/swap-04.adoc[_» more&period;&period;&period;_]#

Exchange the value of the specified `a` `JsonArray` with that of the specified `b` `JsonArray`&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee&period; This operation has O&lsqb;1&rsqb;complexity if `a` was created with the same allocator as `b`&semi; otherwise, it has O&lsqb;n&plus;m&rsqb; complexity, where n and m are the number of elements in `a` and `b`, respectively&period;


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

[.small]#xref:BloombergLP/bdljsn/swap-02.adoc[_» more&period;&period;&period;_]#

Exchange the values of the specified `a` and `b` objects&period; This exception provides the no&hyphen;throw exception&hyphen;safety guarantee&period; Note that, since `a` and `b` have the same value (a class invariant), this operation is a no&hyphen;op&period;


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

[.small]#xref:BloombergLP/bdljsn/swap-03c.adoc[_» more&period;&period;&period;_]#

Exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise&period;


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

[.small]#xref:BloombergLP/bdljsn/swap-088.adoc[_» more&period;&period;&period;_]#

Exchange the value of the specified `a` `JsonObject` with that of the specified `b` `JsonObject`&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee&period; This operation has O&lsqb;1&rsqb;complexity if `a` was created with the same allocator as `b`&semi; otherwise, it has O&lsqb;n&plus;m&rsqb; complexity, where n and m are the number of elements in `a` and `b`, respectively&period;


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

[.small]#xref:BloombergLP/bdljsn/swap-085.adoc[_» more&period;&period;&period;_]#

Exchange the values of the specified `a` and `b` objects&period; This function provides the no&hyphen;throw exception&hyphen;safety guarantee&period;


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

[.small]#xref:BloombergLP/bdljsn/swap-033.adoc[_» more&period;&period;&period;_]#


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