Guiliani-implementation of an auto-pointer. More...
#include <GUIAutoPtr.h>
Public Types | |
| typedef T | element_type |
| typedef of element type | |
Public Member Functions | |
| CGUIAutoPtr (CGUIAutoPtr< T > &kSource) throw () | |
| CGUIAutoPtr (element_type *p, eC_Bool bIsArray) throw () | |
| ~CGUIAutoPtr () throw () | |
| element_type * | get () const throw () |
| template<class Y > | |
| operator CGUIAutoPtr< Y > () throw () | |
| Convert this auto pointer with type T to auto pointer with type Y. | |
| element_type & | operator* () const throw () |
| element_type * | operator-> () const throw () |
| CGUIAutoPtr< T > & | operator= (CGUIAutoPtr< T > &kSource) throw () |
| CGUIAutoPtr & | operator= (element_type *p) |
| element_type * | release () throw () |
| void | reset (element_type *p=0) throw () |
Guiliani-implementation of an auto-pointer.
The CGUIAutoPtr template class describes an object that stores a pointer to a single allocated object of type T that ensures that the object to which it points gets destroyed automatically when control leaves a scope. In other words: If you allocate memory and assign it to an auto-pointer, the auto-pointer will delete this memory if it gets destructed.
A typical use-case example would be:
A demo use-case where a UNICODE-String gets converted to an array of ASCII-characters:
|
inlineexplicit | ||||||||||||||||||||
Constructor
| p | Pointer to object |
| bIsArray | Whether to allocate as array |
|
inline | ||||||||||||||
Copy-constructor.
| kSource | Source object to be copied. The pointer in the source will be set to NULL. |
|
inline | |||||||||||||
Destructor.
|
inline | |||||||||||||
Extract pointer.
|
inline | |||||||||||||
dereference operator
|
inline | |||||||||||||
arrow operator
|
inline | ||||||||||||||
Operator= method.
| kSource | Source object to be copied. The source pointer will be set to NULL. |
|
inline |
Overloaded operator = deletes the old pointer and sets the pointer.
| p |
|
inline | |||||||||||||
Release pointer. This class will not control the pointer anymore.
|
inline | ||||||||||||||
Reset the pointer to other one, the original pointer will be deleted.
| p |