Data Structures | Static Public Member Functions

ts::IntrusivePtrPolicy< T > Class Template Reference

Default policy class for intrusive pointers. More...

#include <IntrusivePtr.h>

Data Structures

class  Order
 Strict weak order for STL containers. More...

Static Public Member Functions

static void dereferenceCheck (T *)
 Called when the pointer is dereferenced.
static void finalize (T *t)
 Perform clean up on a target object that is no longer referenced.

Detailed Description

template<typename T>
class ts::IntrusivePtrPolicy< T >

Default policy class for intrusive pointers.

This allows per type policy, although not per target instance. Clients can override policy by specializing this class for the target type.

    template <> IntrusivePtrPolicy<SomeType>
      : IntrusivePtrDefaultPolicy {
     ... Redefinition of methods and nested types ...
    };

The inherited class will provide the default definitions so you can override only what is different. Although this can be omitted if you override everything, it is more robust for maintenance to inherit anyway.

Definition at line 320 of file IntrusivePtr.h.


Member Function Documentation

template<typename T >
void ts::IntrusivePtrPolicy< T >::dereferenceCheck ( T *   )  [static]

Called when the pointer is dereferenced.

Default is empty (no action).

Definition at line 385 of file IntrusivePtr.h.

template<typename T >
void ts::IntrusivePtrPolicy< T >::finalize ( T *  t  )  [static]

Perform clean up on a target object that is no longer referenced.

Default is calling delete. Any specialization that overrides this must clean up the object. The primary use of this is to perform a clean up other than delete.

Note:
When this is called, the target object reference count is zero. If it is necessary to pass a smart pointer to the target object, it will be necessary to call IntrusivePtr::release to drop the reference without another finalization. Further care must be taken that none of the called logic keeps a copy of the smart pointer. Use with caution.
Parameters:
t Target object.

Definition at line 389 of file IntrusivePtr.h.


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