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

This `friend` declaration provides access to the internal data members while constructing a weak pointer from a weak pointer of a different type&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;class ELEMENT&lowbar;TYPE&gt;
class weak&lowbar;ptr;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:bsl/weak_ptr-0d/element_type.adoc[`element&lowbar;type`] 
| Alias to the element type referenced by this `weak&lowbar;ptr`&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/weak_ptr-0d/2constructor-03.adoc[`weak&lowbar;ptr`]         [.small]#[constructor]#
| Constructors
| xref:bsl/weak_ptr-0d/2destructor.adoc[`&#126;weak&lowbar;ptr`] [.small]#[destructor]#
| Destroy this weak pointer object&period; If this weak pointer manages a (possibly shared) object, release the weak reference to that object&period;
| xref:bsl/weak_ptr-0d/operator_assign-09.adoc[`operator&equals;`] 
| Assignment operators
| xref:bsl/weak_ptr-0d/acquireSharedPtr.adoc[`acquireSharedPtr`] 
| Return a `shared&lowbar;ptr` to the observed object, or empty if expired&period;
| xref:bsl/weak_ptr-0d/expired.adoc[`expired`] 
| Return `true` if this weak pointer is in the empty state or the object that it originally referenced has been destroyed, and `false` otherwise&period;
| xref:bsl/weak_ptr-0d/lock.adoc[`lock`] 
| Return a shared pointer to the object referred to by this weak pointer if `false &equals;&equals; expired()`, and a shared pointer in the empty state otherwise&period;
| xref:bsl/weak_ptr-0d/numReferences.adoc[`numReferences`] 
| Return the number of `shared&lowbar;ptr` owners of the observed object&period;
| xref:bsl/weak_ptr-0d/owner_before-00.adoc[`owner&lowbar;before`] 
| Return whether this `weak&lowbar;ptr` precedes `other` in owner order&period;
| xref:bsl/weak_ptr-0d/owner_equal-02.adoc[`owner&lowbar;equal`] 
| Return whether this pointer shares ownership with `other`&period;
| xref:bsl/weak_ptr-0d/owner_hash.adoc[`owner&lowbar;hash`] 
| Return a hash value based on this pointer&apos;s ownership identity&period;
| xref:bsl/weak_ptr-0d/rep.adoc[`rep`] 
| Return the address of the held representation, or null if empty&period;
| xref:bsl/weak_ptr-0d/reset.adoc[`reset`] 
| Reset this `weak&lowbar;ptr` to the empty state&period;
| xref:bsl/weak_ptr-0d/swap.adoc[`swap`] 
| Exchange the state of this `weak&lowbar;ptr` with `other`&period;
| xref:bsl/weak_ptr-0d/use_count.adoc[`use&lowbar;count`] 
| Return the number of `shared&lowbar;ptr` owners of the observed object&period;
| xref:bsl/weak_ptr-0d/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;weak&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;, is&lowbar;nothrow&lowbar;move&lowbar;constructible&gt;`] 
| Nested trait declaration for `is&lowbar;nothrow&lowbar;move&lowbar;constructible`&period;
|===


== Deduction Guides

[cols="1,4"]
|===
| Name| Description
| xref:bsl/weak_ptr-07.adoc[`weak&lowbar;ptr&lt;ELEMENT&lowbar;TYPE&gt;`] 
| Deduce the specified type `ELEMENT&lowbar;TYPE` corresponding template parameter of the `bsl&colon;&colon;shared&lowbar;ptr` supplied to the constructor of `weak&lowbar;ptr`&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `bsl::weak&lowbar;ptr`
| This `friend` declaration provides access to the internal data members while constructing a weak pointer from a weak pointer of a different type&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:bsl/swap-0447.adoc[`swap`]
| Exchange the states of the specified `weak&lowbar;ptr` objects `a` and `b`&period;
|===


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