Hi
The reason for this behavior is that the underline implementation is different between CString and std::string.
Try to run the code below:
string str;
memset (&str, 0, sizeof(string)); // the Isolator zeros the returned fake instance
str = "abc";
CString mstr;
memset (&mstr, 0, sizeof(CString));
mstr = "abc";
My guess is that in std:string the buffer that holds the string is defined as array:
char buf[1024];
While CString buffer is defined as a pointer:
char* buf;
When you set the std:string instance to zero you still have a valid pointer to buffer with zero length string which is legal detestation for a string.
CString instance has a null pointer to string which in result gives you the access violation exception.
Example:
// like std:string
class A
{
public:
char buf[1024];
};
// like CString
class B
{
public:
char *buf;
};
// main
A a;
memset (&a, 0, sizeof(A));
B b;
memset(&b, 0, sizeof(B));
strcpy (a.buf, "abc"); // <== ok
strcpy (b.buf, "abc"); // <== access violation exception
That been said we are looking for a solution or at least workaround for this problem.
I'll update you as soon as will have something.