[#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;_]#

Create a weak pointer that refers to the same object (if any) as the specified `original` weak pointer, and increment the number of weak references to the object managed by `original` (if any)&period; Note that if `original` is in the empty state, this weak pointer will be initialized to the empty state&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;_]#

Create a `weak&lowbar;ptr` that shares ownership with the specified `other` weak pointer&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;_]#

Create a weak pointer that refers to the same object (if any) as the specified `other` compatible weak pointer, taking ownership of `other`&apos;s reference by move&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;_]#

Create a weak pointer that refers to the same object (if any) as the specified `other` (shared or weak) pointer of the (template parameter) `COMPATIBLE&lowbar;TYPE`, and increment the number of weak references to the object managed by `other` (if any)&period; If `COMPATIBLE&lowbar;TYPE &ast;` is not implicitly convertible to `ELEMENT&lowbar;TYPE &ast;`, then a compiler diagnostic will be emitted&period; Note that if `other` is in the empty state, this weak pointer will be initialized to the empty state&period; Create a `weak&lowbar;ptr` that shares ownership with the specified `other` shared pointer&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;_]#


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