#include <toast/weak_unintrusive_ptr.hpp>
The complement of toast::unintrusive_ptr. Weak pointers are used to avoid circular references. If A -> B -> A, then without using weak pointers A and B will keep each other alive perpetually because their reference counts can never reach zero without the other dying.
Since a weak pointer doesn't keep the object alive, when calling lock() the returned unintrusive_ptr may be NULL. You will need to check for this before using the returned unintrusive_ptr.
Public Types | |
typedef T | element_type |
Public Member Functions | |
weak_unintrusive_ptr (weak_unintrusive_ptr const &r) | |
template<class Y> | |
weak_unintrusive_ptr (weak_unintrusive_ptr< Y > const &r) | |
template<class Y> | |
weak_unintrusive_ptr (unintrusive_ptr< Y > const &r) | |
weak_unintrusive_ptr & | operator= (weak_unintrusive_ptr const &r) |
template<class Y> | |
weak_unintrusive_ptr & | operator= (weak_unintrusive_ptr< Y > const &r) |
template<class Y> | |
weak_unintrusive_ptr & | operator= (unintrusive_ptr< Y > const &r) |
long | use_count () const |
bool | expired () const |
unintrusive_ptr< T > | lock () const |
void | reset () |
void | swap (weak_unintrusive_ptr< T > &b) |
Friends | |
class | count_wrapper |
class | unintrusive_ptr |
toast::weak_unintrusive_ptr< T >::weak_unintrusive_ptr | ( | unintrusive_ptr< Y > const & | r | ) | [inline] |
References toast::unintrusive_ptr< T >::m_wrapper.