[#bsl-weak_ptr-0d-2constructor-03]
= xref:bsl.adoc[bsl]::xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr]::weak&lowbar;ptr
:relfileprefix: ../../
:mrdocs:

Constructors

== Synopses

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

Create a weak pointer in the empty state and referring to no object, i&period;e&period;, a weak pointer having no representation&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
constexpr
xref:bsl/weak_ptr-0d/2constructor-06.adoc[weak&lowbar;ptr]() noexcept;
----

[.small]#xref:bsl/weak_ptr-0d/2constructor-06.adoc[_» more&period;&period;&period;_]#

Copy&hyphen;construct a `weak&lowbar;ptr` from `original`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/weak_ptr-0d/2constructor-0d.adoc[weak&lowbar;ptr](xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr] const& original) noexcept;
----

[.small]#xref:bsl/weak_ptr-0d/2constructor-0d.adoc[_» more&period;&period;&period;_]#

Construct a `weak&lowbar;ptr` observing the same object as `other`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/weak_ptr-0d/2constructor-086.adoc[weak&lowbar;ptr](xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE&gt;] const& other) noexcept;
----

[.small]#xref:bsl/weak_ptr-0d/2constructor-086.adoc[_» more&period;&period;&period;_]#

Move&hyphen;construct a `weak&lowbar;ptr` from a compatible `other`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/weak_ptr-0d/2constructor-0fa.adoc[weak&lowbar;ptr](xref:bsl/weak_ptr-0d.adoc[weak&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE&gt;]&& other) noexcept;
----

[.small]#xref:bsl/weak_ptr-0d/2constructor-0fa.adoc[_» more&period;&period;&period;_]#

Create a weak pointer that refers to the same object (if any) as the specified `original` weak pointer, and reset `original` to an empty state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:bsl/weak_ptr-0d/2constructor-085.adoc[weak&lowbar;ptr](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef&lt;weak&lowbar;ptr&gt;] original) noexcept;
----

[.small]#xref:bsl/weak_ptr-0d/2constructor-085.adoc[_» more&period;&period;&period;_]#

Construct a `weak&lowbar;ptr` observing the same object as `other`&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class COMPATIBLE&lowbar;TYPE&gt;
xref:bsl/weak_ptr-0d/2constructor-0f8.adoc[weak&lowbar;ptr](xref:bsl/shared_ptr-0a.adoc[shared&lowbar;ptr&lt;COMPATIBLE&lowbar;TYPE&gt;] const& other) noexcept;
----

[.small]#xref:bsl/weak_ptr-0d/2constructor-0f8.adoc[_» more&period;&period;&period;_]#

== Parameters

[cols="1,4"]
|===
| Name| Description
| *original*
| source object to copy or move from
| *other*
| other pointer to compare or share ownership with
|===


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