Click here to Skip to main content
15,890,882 members

Comments by Michael Waters (Top 7 by date)

Michael Waters 8-Dec-16 19:04pm View    
That's the best option that I have been able to find, but I've had some trouble getting to work.
Michael Waters 3-May-11 12:47pm View    
It's been a couple of weeks since I had a chance to implement this approach, and I ran into another obstacle. It seems that CString (which I'm using as the key to my hash table implementation) doen't overload the inplace new operator at all. So even after I derive a class from CString and overload it's inplace new operator, the compiler still spits out that it doesn't recognize the class-specific inplace new operator. I couldn't figure out WHY that was the case, until I ran across the following http://www.gotw.ca/publications/mill15.htm
, which explained why it is if CString doesn't overload the inplace new, my own overload won't compile.

So, it looks like I will have to rewrite my hash table to use a different key (probably a copy of CString, with the appropriately overloaded new operator), but I doubt I'll get a chance to do that level of rewrite any time in the near future. I thiknk I will go ahead and accept this solution, tentatively, since I'm pretty sure, from my research, that this approach will prove correct.

That's an awful lot of work just to make _DEBUG report line numbers! And here I thought I was asking a question that was going to have a simple solution :)
Michael Waters 19-Apr-11 17:14pm View    
I only undefine the debug version for the one particular code block - and I might mention that when I tracked down the MFC code and saw what it was doing, it explained all those CMap memory leaks reported in the Output window that didn't have line numbers attached to them. I would think after all these years, the MFC code would have been modified with a better work around than just "don't do that".
Michael Waters 19-Apr-11 17:10pm View    
Interesting approach, but I don't think it's quite the solution I need.
Michael Waters 19-Apr-11 17:06pm View    
But the issue of the inplace syntax is key (literally). I have a string hash table with a previously allocated bucket, practically a copy of CMapStringToOb (that's how I found my soltion, because it's what Micorsoft does), and it uses the inplace syntax to instantiate an empty string key for each new bucket in the hash. I'll try your approach and see what happens.