GlobalObjects
|
Especially for GenericPersistent or derived classes of Persistent the Forget method for std::shared_ptr. More...
#include <GloTypes.h>
Public Member Functions | |
void | operator() (T *ptr) |
Especially for GenericPersistent or derived classes of Persistent the Forget method for std::shared_ptr.
Objects of the type GenericPersistent or derived classes of Persistent have a reference counter and must not be removed from memory using the destructor. Objects with a reference counter may only be instantiated once. When passing to another instance, the reference counter is incremented using Persistent::remember(). If the now owning instance no longer needs the object, the reference counter is decremented using Persistent::forget(). If the reference counter runs to 0, the destructor is called.
This error-prone method can be avoided by using the std::shared_ptr if the Forgetter is passed when instantiating a persistent object.
Example (PersClass is the persistent class):
|
inline |