[#BloombergLP-bdljsn-swap-0b] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdljsn.adoc[bdljsn]::swap :relfileprefix: ../../ :mrdocs: `swap` overloads == Synopses Declared in `<bdljsn_error.h>` Exchange the values of the specified `a` and `b` objects. This function provides the no‐throw exception‐safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise. [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..._]# Exchange the value of the specified `a` `Json` object with that of the specified `b` `Json` object. If an exception is thrown, both objects are left in valid but unspecified states. This operation guarantees O[1] complexity. The behavior is undefined unless `a` was created with the same allocator as `b`. [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..._]# Exchange the value of the specified `a` `JsonArray` with that of the specified `b` `JsonArray`. This function provides the no‐throw exception‐safety guarantee. This operation has O[1]complexity if `a` was created with the same allocator as `b`; otherwise, it has O[n+m] complexity, where n and m are the number of elements in `a` and `b`, respectively. [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..._]# Exchange the values of the specified `a` and `b` objects. This exception provides the no‐throw exception‐safety guarantee. Note that, since `a` and `b` have the same value (a class invariant), this operation is a no‐op. [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..._]# Exchange the values of the specified `a` and `b` objects. This function provides the no‐throw exception‐safety guarantee if the two objects were created with the same allocator and the basic guarantee otherwise. [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..._]# Exchange the value of the specified `a` `JsonObject` with that of the specified `b` `JsonObject`. This function provides the no‐throw exception‐safety guarantee. This operation has O[1]complexity if `a` was created with the same allocator as `b`; otherwise, it has O[n+m] complexity, where n and m are the number of elements in `a` and `b`, respectively. [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..._]# Exchange the values of the specified `a` and `b` objects. This function provides the no‐throw exception‐safety guarantee. [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..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#