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

Create an aliased `shared&lowbar;ptr` sharing ownership with `source`&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ANY&lowbar;TYPE&gt;
shared&lowbar;ptr(
    xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr&lt;ANY&lowbar;TYPE&gt;] const& source,
    ELEMENT&lowbar;TYPE* object) noexcept;
----

== Description

Create a shared pointer that manages the same modifiable object (if any) as the specified `source` shared pointer to the (template parameter) type `ANY&lowbar;TYPE`, and that refers to the modifiable object at the specified `object` address&period; The resulting shared pointer is known as an &quot;alias&quot; of `source`&period; Note that typically the objects referred to by `source` and `object` have identical lifetimes (e&period;g&period;, one might be a part of the other), so that the deleter for `source` will destroy them both, but they do not necessarily have the same type&period; Also note that if `source` is empty, then an empty shared pointer is created, even if `object` is not null (in which case this empty shared pointer will refer to the same object as `object`)&period; Also note that if `object` is null and `source` is not empty, then a reference&hyphen;counted null pointer alias will be created&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *source*
| source shared pointer that supplies ownership
| *object*
| object to refer to while sharing ownership with `source`
|===


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