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

Create a shared pointer that manages a modifiable object of (template parameter) type `CONVERTIBLE&lowbar;TYPE` and refers to the specified `(ELEMENT&lowbar;TYPE &ast;)ptr`&period; The currently installed default allocator is used to allocate and deallocate the internal representation of the shared pointer&period; When all references have been released, the object pointed to by the managed pointer will be destroyed by a call to `delete ptr`&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; 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&period; If an exception is thrown allocating storage for the representation, then `delete ptr` will be called&period; Note that if `ptr` is a null&hyphen;pointer constant, the compiler will actually select the `shared&lowbar;ptr(bsl&colon;&colon;nullptr&lowbar;t)` constructor, resulting in an empty shared pointer&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(CONVERTIBLE&lowbar;TYPE* ptr);
----


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