I am trying to overload the global operator new and delete for a performance sensitive application. I have read the concerns described at http://www.informit.com/articles/ar
If you are using Visual Studio and using precompiled headers, then you can throw the include into there. I think gcc has some form of precompiling headers as well, which would improve your compilation times as well.
If you want to overload the global operator new
and operator delete
, you just need to implement it. You don't need to explicitly define it everywhere since it already is defined as part of the language.
Edit: If you want to define an operator new that takes different parameters, then you'll need to #include it everywhere. However you do that is up to you; it's mostly a matter of style.
And don't forget to implement all the variants of global operator new and delete: new
, new[]
, delete
, delete[]
, and the std::nothrow
variants.