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

Create a `shared&lowbar;ptr` from the specified arguments&period;

== Synopsis

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

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

== Description

Create a shared pointer that takes over the management of the modifiable object of (template parameter) type `COMPATIBLE&lowbar;TYPE` previously managed by the auto pointer object that the specified `autoRef` refers to&semi; this shared pointer refers to the same object that it manages, and `delete(get())` 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 `COMPATIBLE&lowbar;TYPE &ast;` is convertible to `ELEMENT&lowbar;TYPE &ast;`&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *basicAllocator*
| allocator used to supply memory
|===


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