bsl::shared_ptr::operator=

Transfer, to this shared pointer, ownership of the object managed by the specified rhs unique pointer to the (template parameter) type COMPATIBLE_TYPE, and make this shared pointer refer to (ELEMENT_TYPE *)rhs.get(). The deleter of rhs will be called to destroy the shared object when all references have been released. If this shared pointer is already managing a (possibly shared) object, then release the reference to that shared object, and destroy it using its associated deleter if this shared pointer held the last shared reference to that object. This function does not exist unless unique_ptr<COMPATIBLE_TYPE, DELETER>::pointer is convertible to ELEMENT_TYPE *. Note that if rhs is empty, then this shared pointer will be empty after the assignment. Also note that this function creates a shared_ptr with an unspecified deleter type that satisfies this contract; the C++11 standard specifies the exact deleter that should be in use after assignment, so this implementation may be non-conforming.

Synopsis

Declared in <bslstl_sharedptr.h>

template<
    class COMPATIBLE_TYPE,
    class UNIQUE_DELETER>
shared_ptr&
operator=(std::unique_ptr<COMPATIBLE_TYPE, UNIQUE_DELETER>&& rhs)
requires is_convertible<
            typename std::unique_ptr<COMPATIBLE_TYPE, UNIQUE_DELETER>::pointer,
                                     ELEMENT_TYPE *>::value;