PLaSK library
|
Template for base class of object holder. More...
#include <plask/memory.hpp>
Public Member Functions | |
HolderRef () | |
HolderRef (T *held) | |
Construct a holder with given held object. | |
bool | isNotNull () const |
bool | isNull () const |
void | reset (T *new_held) |
Protected Attributes | |
shared_ptr< T > | held |
Hold object. Typically can be nullptr only after move assignment. | |
Template for base class of object holder.
It allow to hold polymorphic class inside one type and use reference counting to delete held object in proper time.
Typically, subclasses adds some delegates methods to held object. Hold object is stored by pointer, so it can store class derived from T. Stored object is deleted in destructor when last reference to it is lost.
T | type of class to hold |
Definition at line 141 of file memory.hpp.
|
inline |
Definition at line 150 of file memory.hpp.
|
inline |
Construct a holder with given held
object.
held | object to hold |
Definition at line 156 of file memory.hpp.
|
inline |
Definition at line 158 of file memory.hpp.
|
inline |
Definition at line 160 of file memory.hpp.
|
inline |
Definition at line 162 of file memory.hpp.
|
protected |
Hold object. Typically can be nullptr only after move assignment.
Definition at line 146 of file memory.hpp.