[#bsl-shared_ptr-0a-2constructor-0735]
= 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 `adoptee` to the (template parameter) type `COMPATIBLE&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; This function does not exist unless `unique&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE, DELETER&gt;&colon;&colon;pointer` is convertible to `ELEMENT&lowbar;TYPE &ast;`&period; Note that this function creates a `shared&lowbar;ptr` with an unspecified deleter type that has satisfies this contract, which might not be the deleter of `rhs`, which is specified by the C&plus;&plus; standard&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class COMPATIBLE&lowbar;TYPE,
    class UNIQUE&lowbar;DELETER&gt;
requires is&lowbar;convertible&lt;
                      typename std&colon;&colon;unique&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE,
                                               UNIQUE&lowbar;DELETER&gt;&colon;&colon;pointer,
                      ELEMENT&lowbar;TYPE &ast;&gt;&colon;&colon;value
shared&lowbar;ptr(
    std::unique&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE, UNIQUE&lowbar;DELETER&gt;&& adoptee,
    xref:BloombergLP/bslma/Allocator.adoc[BloombergLP::bslma::Allocator]* basicAllocator = 0);
----


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