Construct a weak_ptr observing the same object as other.

Synopsis

Declared in <bslstl_sharedptr.h>

template<class COMPATIBLE_TYPE>
weak_ptr(weak_ptr<COMPATIBLE_TYPE> const& other) noexcept;

Description

Create a weak pointer that refers to the same object (if any) as the specified other 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.

Parameters

Name

Description

other

other pointer to compare or share ownership with

Created with MrDocs