[#bsl-swap-092]
= xref:bsl.adoc[bsl]::swap
:relfileprefix: ../
:mrdocs:

Efficiently exchange the states of the specified `a` and `b` shared pointers such that each will refer to the object formerly referred to by the other, and each will manage the object formerly managed by the other&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;sharedptr&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ELEMENT&lowbar;TYPE&gt;
void
swap(
    xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]& a,
    xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]& b) noexcept;
----


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