Move‐construct a shared_ptr from a compatible other.

Synopsis

Declared in <bslstl_sharedptr.h>

template<class COMPATIBLE_TYPE>
shared_ptr(shared_ptr<COMPATIBLE_TYPE>&& other) noexcept;

Description

Create a shared pointer that refers to and assumes management of the same object (if any) as the specified other shared pointer to the (template parameter) type COMPATIBLE_TYPE, using the same deleter as other to destroy the shared object, and refers to (ELEMENT_TYPE*)other.get(). If COMPATIBLE_TYPE * is not implicitly convertible to ELEMENT_TYPE *, then a compiler diagnostic will be emitted indicating the error. Note that if other is empty, then an empty shared pointer is created, which may still point to an un‐managed object if other were constructed through an aliasing constructor.

Parameters

Name

Description

other

other pointer to compare or share ownership with

Created with MrDocs