hdnum::CP< T, P > Class Template Reference

Pointer with a reference count in the pointed-to object. More...

#include <countingptr.hh>

List of all members.


Detailed Description

template<typename T, typename P = DeletingMemoryManagementPolicy>
class hdnum::CP< T, P >

Pointer with a reference count in the pointed-to object.

Template Parameters:
T The type of the pointed-to object. Must be derived from Countable.
P What to do when the reference count reaches 0. Two predefined policy classes are available: NondeletingMemoryManagementPolicy and DeletingMemoryManagementPolicy (the default).
An object cp of class CP points to another object of a class derived from Countable, or to 0. If it does not point to 0, it will keep track of how many CP objects point to the same object. If cp stops pointing to the target object, it will decrement its reference count, and if the reference count reaches zero may or may not delete the target object, depending on what the memory managment policy dictates.

cp may be set via assingment from an apropriate C pointer or another CP of the same type. To access the pointed to object, the expressions *cp and cp->member may be used, where member is a member of the pointed to object. Finally, CP objects may be compared using == and != to find out whether they point to the same object.


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

Generated on Mon Oct 12 21:45:48 2009 for Heidelberg Educational Numerics Library by  doxygen 1.5.5