12 #ifndef ROC_CORE_ALLOCATION_POLICY_H_
13 #define ROC_CORE_ALLOCATION_POLICY_H_
31 template <
class T>
void destroy(T&
object) {
54 template <
class T>
void destroy(T&
object) {
70 typedef void (*DestroyFunc)(
void*);
76 : destroy_func_((DestroyFunc)destroy_func) {
78 roc_panic(
"allocation policy: null function");
83 template <
class T>
void destroy(T&
object) {
84 destroy_func_(&
object);
88 DestroyFunc destroy_func_;
Allocation policy for objects allocated using IArena.
ArenaAllocation(IArena &arena)
Initialize.
void destroy(T &object)
Destroy object and return memory to arena.
IArena & arena() const
Get arena.
Allocation policy for objects with custom deallocation function.
CustomAllocation(void(*destroy_func)(T *))
Initialize.
void destroy(T &object)
Invoke custom destruction function.
void destroy_object(T &object)
Destroy object and deallocate its memory.
void destroy_object(T &object)
Destroy object and deallocate its memory.
Allocation policy for objects that does not have automatic deallocation.
void destroy(T &)
No-op. When SharedPtr or ScopedPtr "destroys" object, nothing happens. The user is responsible for de...
Allocation policy for objects allocated using IPool.
PoolAllocation(IPool &pool)
Initialize.
IPool & pool() const
Get pool.
void destroy(T &object)
Destroy object and return memory to pool.
#define roc_panic(...)
Print error message and terminate program gracefully.