toast::weak_unintrusive_ptr< T > Class Template Reference
[toast unintrusive pointer]

#include <toast/weak_unintrusive_ptr.hpp>

List of all members.


Detailed Description

template<class T>
class toast::weak_unintrusive_ptr< T >

Weak unintrusive smart pointer.

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_ptroperator= (weak_unintrusive_ptr const &r)
template<class Y>
weak_unintrusive_ptroperator= (weak_unintrusive_ptr< Y > const &r)
template<class Y>
weak_unintrusive_ptroperator= (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


Constructor & Destructor Documentation

template<class T>
template<class Y>
toast::weak_unintrusive_ptr< T >::weak_unintrusive_ptr ( unintrusive_ptr< Y > const &  r  )  [inline]

Warning:
This constructor reads *and* potentially writes to the provided unintrusive_ptr. Simultaneous read/writes are not thread- safe.

References toast::unintrusive_ptr< T >::m_wrapper.


The documentation for this class was generated from the following file:

SourceForge.net Logo