GCpp::weak_ptr< T > Class Template Reference

Weak pointer to managed objects. More...

#include <weak_pointer.hpp>

List of all members.

Public Member Functions

 weak_ptr (gc_ptr< T > &p_item)
 Constructor.
 operator gc_ptr< T > () const
 Cast operator.


Detailed Description

template<class T>
class GCpp::weak_ptr< T >

Weak pointer to managed objects.

Allows accessing managed instances without being recognized by the collectors. A weak pointer validates against the block of memory it points to, not the strong pointer it's been created from. Be careful to either stop the collector or having at least one strong (gc_ptr) pointer referencing the same object(s) while working with weak pointers.

Definition at line 29 of file weak_pointer.hpp.


Constructor & Destructor Documentation

template<class T>
GCpp::weak_ptr< T >::weak_ptr ( gc_ptr< T > &  p_item  )  [inline, explicit]

Constructor.

This instance references the same object as the given gc_ptr after construction.

Parameters:
p_item strong pointer, should not point to 0

Definition at line 42 of file weak_pointer.hpp.


Member Function Documentation

template<class T>
GCpp::weak_ptr< T >::operator gc_ptr< T > (  )  const [inline]

Cast operator.

Creates a strong pointer from this, but only if this is valid.

Returns:
new gc_ptr instance
Exceptions:
bad_weak_pointer if this is invalid

Definition at line 52 of file weak_pointer.hpp.


The documentation for this class was generated from the following file:
Generated on Thu Dec 27 14:02:01 2007 for GC++ by  doxygen 1.5.4