bsl::swap

Exchange the states of the specified weak_ptr objects a and b.

Synopsis

Declared in <bslstl_sharedptr.h>

template<class ELEMENT_TYPE>
void
swap(
    weak_ptr<ELEMENT_TYPE>& a,
    weak_ptr<ELEMENT_TYPE>& 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.

Parameters

NameDescription
afirst object to exchange
bsecond object to exchange