#define delete operator

So my question is how to define the delete operator. I was able to do that with the new:

 
#define new new ( __FILE__ , __LINE__ ) //for my own new function void* operator //new(size_t size, const char* szFile, unsigned int nLineNo) 


And I want to do the same for the delete but it don't work

1
2
#define delete delete ( __FILE__ , __LINE__ ) //for my own delete function
//void operator delete(void* pMem, const char* szFile, unsigned int nLineNo) 
Why on earth don't you just overload the operators rather than trying to use #define?????????


Google to find out how to do it.
Cause the new function will become ambiguous. I use define to tell the compiler exactly what function to call. Here is the msdn document where I get this http://msdn.microsoft.com/en-us/library/x98tx3cf%28v=vs.100%29.aspx. But the problem is that, this define doesn't work on the delete operator.
Topic archived. No new replies allowed.