[#bsl-shared_ptr-0a-2constructor-000] = xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared_ptr]::shared_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. The number of references to `rep` is _NOT_ incremented. The behavior is undefined unless `rep` was previously obtained from an existing `shared_ptr`, `rep‐>disposeObject` has not been called, and `rep‐>numReferences() > 0`. Note that this constructor is intended for use by `weak_ptr::lock`, and it would be surprising to find another client. This solves an obscure problem that arises from unusual use of classes derived from `enable_shared_from_this`. 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_ptr` object releases the shared object from its management. == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- shared_ptr( ELEMENT_TYPE* ptr, xref:BloombergLP/bslma/SharedPtrRep.adoc[BloombergLP::bslma::SharedPtrRep]* rep, xref:BloombergLP/bslstl/SharedPtr_RepFromExistingSharedPtr.adoc[BloombergLP::bslstl::SharedPtr_RepFromExistingSharedPtr]); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#