I'm overloading the "new" operator in order to keep track of every allocation. I want it to print the size of the allocated memory, as well as the type of the object that is allocated.
I've come up with something like this:
void* operator new(size_t size) {
std::cout << "Allocating " << size << " bytes.\n";
return malloc(size);
}
but I have no clue on how to print the type of the object. Thank you for the help!