This friend declaration provides access to the internal data members while constructing a weak pointer from a weak pointer of a different type.

Synopsis

Declared in <bslstl_sharedptr.h>

template<class ELEMENT_TYPE>
class weak_ptr;

Type Aliases

Name

Description

element_type

Alias to the element type referenced by this weak_ptr.

Member Functions

Name

Description

weak_ptr [constructor]

Constructors

~weak_ptr [destructor]

Destroy this weak pointer object. If this weak pointer manages a (possibly shared) object, release the weak reference to that object.

operator=

Assignment operators

acquireSharedPtr

Return a shared_ptr to the observed object, or empty if expired.

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.

lock

Return a shared pointer to the object referred to by this weak pointer if false == expired(), and a shared pointer in the empty state otherwise.

numReferences

Return the number of shared_ptr owners of the observed object.

owner_before

Return whether this weak_ptr precedes other in owner order.

owner_equal

Return whether this pointer shares ownership with other.

owner_hash

Return a hash value based on this pointer's ownership identity.

rep

Return the address of the held representation, or null if empty.

reset

Reset this weak_ptr to the empty state.

swap

Exchange the state of this weak_ptr with other.

use_count

Return the number of shared_ptr owners of the observed object.

operator BloombergLP::bslmf::NestedTraitDeclaration<weak_ptr<ELEMENT_TYPE>, is_nothrow_move_constructible>

Nested trait declaration for is_nothrow_move_constructible.

Deduction Guides

Name

Description

weak_ptr<ELEMENT_TYPE>

Deduce the specified type ELEMENT_TYPE corresponding template parameter of the bsl::shared_ptr supplied to the constructor of weak_ptr.

Friends

Name

Description

bsl::weak_ptr

This friend declaration provides access to the internal data members while constructing a weak pointer from a weak pointer of a different type.

Non-Member Functions

Name

Description

swap

Exchange the states of the specified weak_ptr objects a and b.

Created with MrDocs