[#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..._]# 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). Note that if `original` is in the empty state, this weak pointer will be initialized to the empty state. [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..._]# Create a `weak_ptr` that shares ownership with the specified `other` weak pointer. [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..._]# Create a weak pointer that refers to the same object (if any) as the specified `other` compatible weak pointer, taking ownership of `other`'s reference by move. [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..._]# 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_TYPE`, and increment the number of weak references to the object managed by `other` (if any). If `COMPATIBLE_TYPE *` is not implicitly convertible to `ELEMENT_TYPE *`, then a compiler diagnostic will be emitted. Note that if `other` is in the empty state, this weak pointer will be initialized to the empty state. Create a `weak_ptr` that shares ownership with the specified `other` shared pointer. [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..._]# [.small]#Created with https://www.mrdocs.com[MrDocs]#