[#bsl-weak_ptr-0d-2constructor-03] = xref:bsl.adoc[bsl]::xref:bsl/weak_ptr-0d.adoc[weak_ptr]::weak_ptr :relfileprefix: ../../ :mrdocs: Constructors == Synopses Declared in `<bslstl_sharedptr.h>` Create a weak pointer in the empty state and referring to no object, i.e., a weak pointer having no representation. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr xref:bsl/weak_ptr-0d/2constructor-06.adoc[weak_ptr]() noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/2constructor-06.adoc[_» more..._]# Copy‐construct a `weak_ptr` from `original`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/weak_ptr-0d/2constructor-0d.adoc[weak_ptr](xref:bsl/weak_ptr-0d.adoc[weak_ptr] const& original) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/2constructor-0d.adoc[_» more..._]# Construct a `weak_ptr` observing the same object as `other`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/weak_ptr-0d/2constructor-086.adoc[weak_ptr](xref:bsl/weak_ptr-0d.adoc[weak_ptr<COMPATIBLE_TYPE>] const& other) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/2constructor-086.adoc[_» more..._]# Move‐construct a `weak_ptr` from a compatible `other`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/weak_ptr-0d/2constructor-0fa.adoc[weak_ptr](xref:bsl/weak_ptr-0d.adoc[weak_ptr<COMPATIBLE_TYPE>]&& other) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/2constructor-0fa.adoc[_» more..._]# 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. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:bsl/weak_ptr-0d/2constructor-085.adoc[weak_ptr](xref:BloombergLP/bslmf/MovableRef.adoc[BloombergLP::bslmf::MovableRef<weak_ptr>] original) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/2constructor-085.adoc[_» more..._]# Construct a `weak_ptr` observing the same object as `other`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class COMPATIBLE_TYPE> xref:bsl/weak_ptr-0d/2constructor-0f8.adoc[weak_ptr](xref:bsl/shared_ptr-0a.adoc[shared_ptr<COMPATIBLE_TYPE>] const& other) noexcept; ---- [.small]#xref:bsl/weak_ptr-0d/2constructor-0f8.adoc[_» more..._]# == 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]#