K
kUfa.scoopex
Hi there!
I have a small problem, and i really dont see any convenient way to fix it.
Basically, i'd like to overload global new operators, into something like
this:
void *operator new( size_t size );
void *operator new( size_t size, AllocationType allocType );
void *operator new( size_t size, MemoryHandler* memHandler );
void *operator new( size_t size, MemoryHandler* memHandler, AllocationType
allocType );
void operator delete( void *pMemory );
It works fine, but i would like to also have a _DEBUG version, for which i'd
like to pass __FILLE__, etc..
Usually i'd write it like this:
#ifndef _DEBUG
void *operator new( size_t size );
#else
void *operator new( size_t size, const char *fileName, int line );
#define new new(__FILE__,__LINE__)
#endif
But here, since i have more new operators, is there any "clean" way to do
that? I'd rather not have #define new1 #define new2 ...
Any idea?
/David
-- Before C++ we had to code all of bugs by hand; now we inherit them.
I have a small problem, and i really dont see any convenient way to fix it.
Basically, i'd like to overload global new operators, into something like
this:
void *operator new( size_t size );
void *operator new( size_t size, AllocationType allocType );
void *operator new( size_t size, MemoryHandler* memHandler );
void *operator new( size_t size, MemoryHandler* memHandler, AllocationType
allocType );
void operator delete( void *pMemory );
It works fine, but i would like to also have a _DEBUG version, for which i'd
like to pass __FILLE__, etc..
Usually i'd write it like this:
#ifndef _DEBUG
void *operator new( size_t size );
#else
void *operator new( size_t size, const char *fileName, int line );
#define new new(__FILE__,__LINE__)
#endif
But here, since i have more new operators, is there any "clean" way to do
that? I'd rather not have #define new1 #define new2 ...
Any idea?
/David
-- Before C++ we had to code all of bugs by hand; now we inherit them.