[#bsl-shared_ptr-0a-2constructor-093] = xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared_ptr]::shared_ptr :relfileprefix: ../../ :mrdocs: Create a shared pointer that manages a modifiable object of (template parameter) type `CONVERTIBLE_TYPE` and refers to the specified `ptr` cast to a pointer to the (template parameter) type `ELEMENT_TYPE`. If the specified `basicAllocator` is not 0, then `basicAllocator` is used to allocate and deallocate the internal representation of the shared pointer and to destroy the shared object when all references have been released; otherwise, 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. If `ptr` is 0, then this shared pointer will still allocate an internal representation to share ownership of that empty state, which will be reclaimed when the last reference is destroyed. Note that if `ptr` is a null‐pointer constant, the compiler will actually select the `shared_ptr(bsl::nullptr_t, BloombergLP::bslma::Allocator *)` constructor, resulting in an empty shared pointer. Note that if `basicAllocator` is a pointer to a class derived from `bslma::Allocator`, the compiler will actually select the following (more general) constructor that has the same behavior: ` template <class CONVERTIBLE_TYPE, class DELETER> shared_ptr(CONVERTIBLE_TYPE *ptr, DELETER * deleter); ` == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class CONVERTIBLE_TYPE> shared_ptr( CONVERTIBLE_TYPE* ptr, xref:BloombergLP/bslma/Allocator.adoc[BloombergLP::bslma::Allocator]* basicAllocator); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#