#ifdef _DEBUG #define MARY_DEBUG_NEW new(__FILE__, __LINE__) #else #define MARY_DEBUG_NEW new #endif #define new MARY_DEBUG_NEW
I then override the new operator with the following function calls
inline void *operator new(size_t size, const char *_file, int _line) inline void *operator new[](size_t size, const char *_file, int _line) inline void *operator new(size_t size) inline void *operator new[](size_t size)
Each one of these calls HeapNew, which deals with the actual allocation of memory.
This seems to cause problems when I start to use XML.
When I include "tinyxml.h", it falls over on the line
rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
with the error
error C2661: 'operator new' : no overloaded function takes 2 arguments
If I include the xml files with my MFC code (using the above new overrides), it falls over in the same place with the following errors
error C2665: 'operator new' : none of the 5 overloads can convert parameter 1 from type 'const char [74]' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\new.h(100): could be 'void *operator new(size_t,const std::nothrow_t &) throw()' c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\new.h(108): or 'void *operator new(size_t,void *)'
Now I appreciate what the error is telling me, but I am unsure as to how to override the new operator again to deal with this one.
Any one encountered this before?
Thanks
Spree












