Exchange the states of the specified shared_ptr objects a and b.
Declared in <bslstl_sharedptr.h>
template<class ELEMENT_TYPE>
void
swap(
shared_ptr<ELEMENT_TYPE>& a,
shared_ptr<ELEMENT_TYPE>& b) noexcept;
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.
| Name | Description |
|---|---|
| a | first object to exchange |
| b | second object to exchange |