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

Exchange the states of the specified `weak&lowbar;ptr` objects `a` and `b`&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/weak_ptr-0d.adoc[weak&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]& a,
    xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;]& b) noexcept;
----

== Description

Efficiently exchange the states of the specified `a` and `b` weak pointers such that each will refer to the object (if any) and representation formerly referred to by the other&period;

== Parameters

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


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