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

Create a `shared&lowbar;ptr` owning null with a deleter&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class DELETER&gt;
shared&lowbar;ptr(
    xref:bsl/nullptr_t-08.adoc[nullptr&lowbar;t] nullPointerLiteral,
    DELETER deleter,
    xref:BloombergLP/bslma/Allocator.adoc[BloombergLP::bslma::Allocator]* basicAllocator = 0);
----

== Description

Create a shared pointer that reference&hyphen;counts the null pointer, and calls the specified `deleter` with a null pointer (i&period;e&period;, invokes `deleter((ELEMENT&lowbar;TYPE &ast;)0)`) when the last shared reference is destroyed&period; The specified `nullPointerLiteral` is not used&period; Optionally specify a `basicAllocator` to allocate and deallocate the internal representation of the shared pointer (including a copy of `deleter`)&period; If `basicAllocator` is 0, the currently installed default allocator is used&period; If an exception is thrown when allocating storage for the internal representation, then `deleter((ELEMENT&lowbar;TYPE &ast;)0)` will be called&period; The behavior is undefined unless `deleter` can be called with a null pointer, and unless the constructor making a copy of `deleter` does not throw an exception&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *nullPointerLiteral*
| null&hyphen;pointer literal (unused&semi; selects this overload)
| *deleter*
| deleter invoked when the last shared reference is released
| *basicAllocator*
| allocator used to supply memory
|===


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