I have a class where I overload new ones and delete (they retrieve and return memory from the memory pool and to the memory pool). It frustrates me that the class on which I am overloaded still has its destructor, called before the called overload function is called. How can i stop this?
class Message { ~Message() { ... } void* operator new(std::size_t sz) { ... } void operator delete(void* ptr) { ... } };
EDIT:
That's right, thinking that class members will be destroyed, but memory will not be freed by destructors; the delete function owns this responsibility, in which case can I stop the freeing of memory?
RESULT: Penny discarded that allocating / freeing memory and building / destroying are separate elements. Now I have empty destructors and overloaded new / delete.
c ++
Graeme
source share