[#bsl-shared_ptr-0a-2constructor-088] = xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared_ptr]::shared_ptr :relfileprefix: ../../ :mrdocs: Create a `shared_ptr` owning null with a deleter. == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class DELETER> shared_ptr( xref:bsl/nullptr_t-08.adoc[nullptr_t] nullPointerLiteral, DELETER deleter, xref:BloombergLP/bslma/Allocator.adoc[BloombergLP::bslma::Allocator]* basicAllocator = 0); ---- == Description Create a shared pointer that reference‐counts the null pointer, and calls the specified `deleter` with a null pointer (i.e., invokes `deleter((ELEMENT_TYPE *)0)`) when the last shared reference is destroyed. The specified `nullPointerLiteral` is not used. Optionally specify a `basicAllocator` to allocate and deallocate the internal representation of the shared pointer (including a copy of `deleter`). If `basicAllocator` is 0, the currently installed default allocator is used. If an exception is thrown when allocating storage for the internal representation, then `deleter((ELEMENT_TYPE *)0)` will be called. 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. == Parameters [cols="1,4"] |=== | Name| Description | *nullPointerLiteral* | null‐pointer literal (unused; 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]#