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

Create a shared pointer that takes ownership of the specified `rep` and refers to the modifiable object at the specified `ptr` address&period; The number of references to `rep` is _NOT_ incremented&period; The behavior is undefined unless `rep` was previously obtained from an existing `shared&lowbar;ptr`, `rep&hyphen;&gt;disposeObject` has not been called, and `rep&hyphen;&gt;numReferences() &gt; 0`&period; Note that this constructor is intended for use by `weak&lowbar;ptr&colon;&colon;lock`, and it would be surprising to find another client&period; This solves an obscure problem that arises from unusual use of classes derived from `enable&lowbar;shared&lowbar;from&lowbar;this`&period; Further note that the caller is responsible for incrementing the `numReferences` count prior to calling this constructor, in order to maintain a consistent reference count when this `shared&lowbar;ptr` object releases the shared object from its management&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
shared&lowbar;ptr(
    ELEMENT&lowbar;TYPE* ptr,
    xref:BloombergLP/bslma/SharedPtrRep.adoc[BloombergLP::bslma::SharedPtrRep]* rep,
    xref:BloombergLP/bslstl/SharedPtr_RepFromExistingSharedPtr.adoc[BloombergLP::bslstl::SharedPtr&lowbar;RepFromExistingSharedPtr]);
----


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