PLaSK library
|
Template for base class of object holder. More...
#include <plask/memory.hpp>
Public Member Functions | |
Holder (T *held) noexcept | |
Construct a holder with given held object. | |
Holder (T &held) noexcept | |
Construct a holder with given held object. | |
Holder (const Holder< T > &to_copy) | |
Copy constructor. | |
Holder (Holder< T > &&to_move) noexcept | |
Move constructor. | |
Holder< T > & | operator= (const Holder &to_copy) |
Copy operator. | |
Holder< T > & | operator= (Holder &&to_move) noexcept |
Move operator. | |
~Holder () | |
Delete held object using delete. | |
Protected Attributes | |
T * | held |
Held object. Typically can be nullptr only after move assignment. | |
Template for base class of object holder.
It allows to hold polymorphic class inside one type.
Typically, subclasses adds some delegates methods to held object. Held object is stored by pointer, so it can store class derived from T. Stored object is deleted in destructor. Holder has all assign and copy constructors which use stored object clone() method.
T | type of class to hold, must have clone() method which make a copy of object |
Definition at line 70 of file memory.hpp.
|
inlinenoexcept |
Construct a holder with given held
object.
held | object to hold, should be not nullptr |
Definition at line 83 of file memory.hpp.
|
inlinenoexcept |
Construct a holder with given held
object.
held | object to hold, should be not nullptr |
Definition at line 89 of file memory.hpp.
|
inline |
Copy constructor.
Use held->clone().
to_copy | object to copy |
Definition at line 95 of file memory.hpp.
|
inlinenoexcept |
Move constructor.
It doesn't call held.clone().
to_move | object to move |
Definition at line 103 of file memory.hpp.
|
inline |
Delete held object using delete.
Definition at line 128 of file memory.hpp.
|
inline |
Copy operator.
Use held->clone().
to_copy | object to copy |
Definition at line 109 of file memory.hpp.
|
inlinenoexcept |
Move operator.
It doesn't call held.clone().
to_move | object to move |
Definition at line 122 of file memory.hpp.
|
protected |
Held object. Typically can be nullptr only after move assignment.
Definition at line 75 of file memory.hpp.