Create a shared_ptr sharing ownership with a compatible other.
Synopsis
Declared in <bslstl_sharedptr.h>
template<class COMPATIBLE_TYPE>
shared_ptr(shared_ptr<COMPATIBLE_TYPE> const& other) noexcept;
Description
Create a shared pointer that manages the same modifiable object (if any) as the specified other shared pointer to the (template parameter) type COMPATIBLE_TYPE, uses 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