Howard Hinnant's reference counting handle class. More...
Public Member Functions | |
bool | isNonUnique () const |
bool | isNull () const |
operator const T * () const | |
const T & | operator* () const |
T & | operator* () |
const T * | operator-> () const |
T * | operator-> () |
const SmartPtr< T > & | operator= (const SmartPtr< T > &rhs) |
int | refCount () const |
SmartPtr (const SmartPtr< T > &other) | |
SmartPtr (T *ptr=0) | |
Protected Attributes | |
T * | ptr_ |
int * | refCount_ |
Howard Hinnant's reference counting handle class.
This is to be used as a pointer to class T. This will feel and smell just like a built-in pointer except: 1. There is no need to call delete on the pointer. 2. The default copy constructor and assignment implement ref-counting. 3. The user may call isNonUnique to determine if this pointer is the only pointer to the data. This can be used to hide the ref-counting behavior of a class. 4. Checks for dereference of a null pointer.
Definition at line 23 of file OptppSmartPtr.h.