[#bsl-shared_ptr-0a-2constructor-0e]
= xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr]::shared&lowbar;ptr
:relfileprefix: ../../
:mrdocs:

Create a shared pointer that takes over the management of the modifiable object previously managed by the specified `autoPtr` to the (template parameter) type `CONVERTIBLE&lowbar;TYPE`, and that refers to `(ELEMENT&lowbar;TYPE &ast;)autoPtr&period;get()`&period; `delete(autoPtr&period;release())` will be called to destroy the shared object when all references have been released&period; Optionally specify a `basicAllocator` used to allocate and deallocate the internal representation of the shared pointer&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; If `CONVERTIBLE&lowbar;TYPE &ast;` is not implicitly convertible to `ELEMENT&lowbar;TYPE &ast;`, then a compiler diagnostic will be emitted indicating the error&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;sharedptr&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class CONVERTIBLE&lowbar;TYPE&gt;
explicit
shared&lowbar;ptr(
    std::auto&lowbar;ptr&lt;CONVERTIBLE&lowbar;TYPE&gt;& autoPtr,
    xref:BloombergLP/bslma/Allocator.adoc[BloombergLP::bslma::Allocator]* basicAllocator = 0);
----


[.small]#Created with https://www.mrdocs.com[MrDocs]#
