The cast operator is a known cause of issues in C++ as it can have unexpected side effects and come into play when you don't want or expect it to (as you've discovered). Generally it is best to avoid using it. This is why the standard STL string has a c_str() member rather than a operator const char *(). I'd strongly recommend you remove the cast operator and use an explicit function call instead.
Main Topics
Browse All Topics





by: jkrPosted on 2009-08-21 at 09:35:03ID: 25153485
Maybe this one can help: http://msdn.microsoft.com/ en-us/maga zine/cc163 742.aspx ("Copy Constructors, Assignment Operators, and More")