TMCSmartPtr< T > Class Template Reference
[MCCore]
List of all members.
Detailed Description
template<class T>
class TMCSmartPtr< T >
Like TMCPtr, TMCSmartPtr is a transparent wrapper around a regular pointer But TMCSmartPtr owns the pointed data, and will delete it in its destructor. It is very useful when you need to create a temporary object as you don't need to worry about destruction (and exceptions). Example:
- Note:
- When you need a temporary buffer, it is better to use a TMCArray instead of TMCSmartPtr and new[] as the array will assert if you go too far.
Constructor & Destructor Documentation
Member Function Documentation
template<class T>
static T* TMCSmartPtr< T >::Assign |
( |
T ** |
pp, |
|
|
T * |
lp | |
|
) |
| | [inline, static, protected] |
template<class T>
void TMCSmartPtr< T >::AssignWithoutDeleting |
( |
T * |
lp |
) |
[inline] |
Assign a new value to the pointer without deleting the object previously pointed by it.
- Parameters:
-
| lp | The new value of the pointer. |
Creates a copy of the object pointed to by fromSmart and points to it. The previous object pointed by this will be deleted.
- Parameters:
-
| fromSmart | a pointer to the object that will be copied |
template<class T>
void TMCSmartPtr< T >::SetToNullWithoutDeleting |
( |
|
) |
[inline] |
Sets the internal pointer to NULL without deleting the pointed object. Use this to transfer ownership of the pointed object to a TMCPtrArray But don't forget to call DeleteAndRemoveAll on the array !
because & has been overriden differently :-(
template<class T>
template<class U >
Transfers the pointed object from fromSmart to this and sets fromSmart to null
- Parameters:
-
| fromSmart | the pointer to acquire |
Friends And Related Function Documentation
The documentation for this class was generated from the following file: