LibMusicXML 3.22
|
the smart pointer implementation More...
#include <smartpointer.h>
Public Member Functions | |
SMARTP () | |
an empty constructor - points to null | |
SMARTP (T *rawptr) | |
build a smart pointer from a class pointer | |
template<class T2> | |
SMARTP (const SMARTP< T2 > &ptr) | |
build a smart pointer from an convertible class reference | |
SMARTP (const SMARTP &ptr) | |
build a smart pointer from another smart pointer reference | |
~SMARTP () | |
the smart pointer destructor: simply removes one reference count | |
operator T* () const | |
cast operator to retrieve the actual class pointer | |
T & | operator* () const |
'*' operator to access the actual class pointer | |
T * | operator-> () const |
operator -> overloading to access the actual class pointer | |
template<class T2> | |
SMARTP & | operator= (T2 p1_) |
operator = that moves the actual class pointer | |
SMARTP & | operator= (T *p_) |
operator = that moves the actual class pointer | |
SMARTP & | operator= (const SMARTP< T > &p_) |
operator = to support inherited class reference | |
template<class T2> | |
SMARTP & | cast (T2 *p_) |
dynamic cast support | |
template<class T2> | |
SMARTP & | cast (const SMARTP< T2 > &p_) |
dynamic cast support | |
bool | operator< (const SMARTP< T > &p_) const |
operator < (require by VC6 for maps) |
A smart pointer is in charge of maintaining the objects reference count by the way of pointers operators overloading. It supports class inheritance and conversion whenever possible.
Instances of the SMARTP class are supposed to use smartable types (or at least objects that implements the addReference and removeReference methods in a consistent way).