In short: with a new placement, this is the only case where an explicit call to the destructor is in order:
baseObj-> ~ Base ();
But that seems awkward, because using your memory pool, you actually force the end user to execute all the books ... this makes your memory pool class no better (and maybe a little worse) than just using std :: vector .
I would not have the user of the newest placement ... rather, if you supply your own memory pool, this should be done with the ObjectPool class:
class ObjectPool { public: template <typename T, typename... A> T* allocate(A... args) { void* create_location;
Honestly, this is the only way for your pool to have more utility, and the end user just creates his own std::vector<uint8_t> .
It should be noted that this does nothing to make T not allocate anything else on the heap ...
source share