I will need to use the placement new operator, if I want to allocate an
object with an allocator other than the one I established (SNAPSHOTALLOC
vs. MODELALLOC).
} \
void operator delete[](void *p, size_t size) { \
model_free(p); \
+ } \
+ void * operator new(size_t size, void *p) { /* placement new */ \
+ return p; \
}
/** SNAPSHOTALLOC declares the allocators for a class to allocate
} \
void operator delete[](void *p, size_t size) { \
snapshot_free(p); \
+ } \
+ void * operator new(size_t size, void *p) { /* placement new */ \
+ return p; \
}
void *model_malloc(size_t size);