[#bsl-shared_ptr-0a-2constructor-09c] = xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared_ptr]::shared_ptr :relfileprefix: ../../ :mrdocs: Create a shared pointer that takes over the management of the modifiable object (if any) previously managed by the specified `managedPtr` to the (template parameter) type `CONVERTIBLE_TYPE`, and that refers to `(ELEMENT_TYPE *)managedPtr.ptr()`. The deleter used in the `managedPtr` will be used to destroy the shared object when all references have been released. Optionally specify a `basicAllocator` used to allocate and deallocate the internal representation of the shared pointer. If `basicAllocator` is 0, the currently installed default allocator is used. If `CONVERTIBLE_TYPE *` is not implicitly convertible to `ELEMENT_TYPE *`, then a compiler diagnostic will be emitted indicating the error. Note that if `managedPtr` is empty, then an empty shared pointer is created and `basicAllocator` is ignored. Also note that if `managedPtr` owns a reference to another shared object (due to a previous call to `shared_ptr<T>::managedPtr`) then no memory will be allocated, and this `shared_ptr` will adopt the `ManagedPtr`s ownership of that shared object. == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class CONVERTIBLE_TYPE> shared_ptr( xref:BloombergLP/bslma/ManagedPtr-0fa.adoc[BloombergLP::bslma::ManagedPtr<CONVERTIBLE_TYPE>] managedPtr, xref:BloombergLP/bslma/Allocator.adoc[BloombergLP::bslma::Allocator]* basicAllocator = 0); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#