I declare a function which takes a CString, and then pass a JString to it. A typecast is necessary, so I create JString::operator CString () const, which builds and returns a CString that copies the JString.
Implicit conversion is done, and my function runs correctly, but on exiting, a memory library de-allocation error results. If I _explicitly_ convert the JString parameter to a CString with a simple (CString) typecast, there's no problem! Why does MSVC 1.52 produce different object code for these possibilities, and how can I fix the implicit conversion to work correctly?
(Or better still, is there a simple C++ string class available that is more efficient than the MFC CString class, and can return references to strings rather than creating gratuitous copies whenever you return string values, like Java's string class?)