Pointer-to-object "keeper" class with automatic deletion. More...
#include <r8bbase.h>
Public Member Functions | |
| template<typename T2> | |
| CPtrKeeper (T2 const aObject) | |
| Constructor assigns a pointer to object to this keeper. | |
| operator T* () const | |
Returns pointer to keeped object, or nullptr, if no object is kept. | |
| T * | operator-> () const |
Returns pointer to keeped object, or nullptr, if no object is being kept. | |
| template<typename T2> | |
| void | operator= (T2 const aObject) |
| Assigns a pointer to object to this keeper. A previously keeped pointer will be reset and object deleted. | |
| void | reset () |
| Resets the keeped pointer and deletes the keeped object. | |
| T * | unkeep () |
| Returns the keeped pointer and resets it in this keeper without object deletion. | |
Pointer-to-object "keeper" class with automatic deletion.
An auxiliary class that can be used for keeping a pointer to object that should be deleted together with the "keeper" by calling object's "delete" operator.
| T | Type of the keeped object, must not include an additional asterisk. |
Constructor assigns a pointer to object to this keeper.
| aObject | Pointer to object to keep, can be nullptr. |
| T2 | Object's pointer type. |
Assigns a pointer to object to this keeper. A previously keeped pointer will be reset and object deleted.
| aObject | Pointer to object to keep, can be nullptr. |
| T2 | Object's pointer type. |