AUTO_DELETE< T > Class Template Reference
#include <basic_types.h>
Public Member Functions | |
AUTO_DELETE (T *iniPtr=NULL) | |
T * | operator= (T *newPtr) |
operator T * () const | |
T * | operator-> () const |
~AUTO_DELETE () | |
Private Member Functions | |
void | destroy () |
AUTO_DELETE (const AUTO_DELETE &) | |
AUTO_DELETE & | operator= (const AUTO_DELETE &) |
Private Attributes | |
T * | myPtr |
Detailed Description
template<class T>
class AUTO_DELETE< T >
AUTO_DELETE: Self-deleting pointer (when going out of scope or changing values)
int function() { ... AUTO_DELETE<Class1> c1; if (cond1) { c1_ptr = < function that returns new Class1 > } ... c1_ptr = func2(); // previous c1_ptr deleted automatically ... if (cond2) { return 0; // c1_ptr data deleted automatically } ... }
Constructor & Destructor Documentation
template<class T >
AUTO_DELETE< T >::AUTO_DELETE | ( | T * | iniPtr = NULL |
) | [inline] |
References AUTO_DELETE< T >::myPtr.
template<class T >
AUTO_DELETE< T >::~AUTO_DELETE | ( | ) | [inline] |
template<class T >
AUTO_DELETE< T >::AUTO_DELETE | ( | const AUTO_DELETE< T > & | ) | [private] |
Member Function Documentation
template<class T >
void AUTO_DELETE< T >::destroy | ( | ) | [inline, private] |
References AUTO_DELETE< T >::myPtr.
Referenced by AUTO_DELETE< T >::operator=(), and AUTO_DELETE< T >::~AUTO_DELETE().
template<class T >
AUTO_DELETE< T >::operator T * | ( | ) | const [inline] |
References AUTO_DELETE< T >::myPtr.
template<class T >
T* AUTO_DELETE< T >::operator-> | ( | ) | const [inline] |
References AUTO_DELETE< T >::myPtr.
template<class T >
T* AUTO_DELETE< T >::operator= | ( | T * | newPtr | ) | [inline] |
References AUTO_DELETE< T >::destroy(), and AUTO_DELETE< T >::myPtr.
Here is the call graph for this function:
template<class T >
AUTO_DELETE& AUTO_DELETE< T >::operator= | ( | const AUTO_DELETE< T > & | ) | [private] |
Member Data Documentation
template<class T >
T* AUTO_DELETE< T >::myPtr [private] |
The documentation for this class was generated from the following file: