August 30th, 2002, 02:37 AM
Overloading Global Vector new and delete
I'm working on a debuging system, and would like the ability to detect when a programmer uses the incorrect form of delete (delete where they should have used delete ). Preferably at compile time, but run time may be sufficient as well. The problem I have run into is that Visual C++ will not allow me to overload new and delete in a global scope (it compiles, but I get a redefinition error - it seems to conflict with my overloaded versions of non-vector new and delete). If I am unable to overload the vector form, then there is no way to tell when an allocation is an array, and therefore no way for me to determine if the correct version of delete has been called. Any assistance someone could offer would be appreciated.