[#bsl-swap-092] = xref:bsl.adoc[bsl]::swap :relfileprefix: ../ :mrdocs: Exchange the states of the specified `shared_ptr` objects `a` and `b`. == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class ELEMENT_TYPE> void swap( xref:bsl/shared_ptr-0a.adoc[shared_ptr<ELEMENT_TYPE>]& a, xref:bsl/shared_ptr-0a.adoc[shared_ptr<ELEMENT_TYPE>]& b) noexcept; ---- == Description 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. == Parameters [cols="1,4"] |=== | Name| Description | *a* | first object to exchange | *b* | second object to exchange |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#