[#bsl-shared_ptr-0a-2constructor-08d] = xref:bsl.adoc[bsl]::xref:bsl/shared_ptr-0a.adoc[shared_ptr]::shared_ptr :relfileprefix: ../../ :mrdocs: Create a shared pointer that refers to and manages the same object as the specified `ptr` if `ptr.expired()` is `false`; otherwise, create a shared pointer in the empty state. Note that the referenced and managed objects may be different if `ptr` was created from a `shared_ptr` in an aliasing state. == Synopsis Declared in `<bslstl_sharedptr.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> explicit shared_ptr(xref:bsl/weak_ptr-0d.adoc[weak_ptr<COMPATIBLE_TYPE>] const& ptr); ---- [.small]#Created with https://www.mrdocs.com[MrDocs]#