template<typename ObjectType, template< class > class OwnershipPolicy = InternalRefCounted, template< class > class DestroyPolicy = DefaultDestroyPolicy>
class cxxtools::SmartPtr< ObjectType, OwnershipPolicy, DestroyPolicy >
This class works like a pointer, but the destructor deletes the held object if this is the last reference. The policy specifies, how the class counts the references. There are 4 policies:
ExternalRefCounted: allocates a reference-count
ExternalAtomicRefCounted: like ExternalRefCounted, but thread safe
InternalRefCounted: the pointed object needs to have a reference-counter with methods addRef() and release(). The release-method deletes the object, when the reference-count drops to 0.
RefLinked: all pointers to a object are linked
The default policy is InternalRefCounted. Another class cxxtools::RefCounted implements proper methods for the pointer, which makes it straight-forward to use.