Hi
developer28 wrote:
> actually i do something like
>
> const char * temp = str1.c_str();
>
> that converts it to a c type string.
>
> and then when i modify the contents of temp, it also affects str2.
You are not allowed to change the contents through a pointer obtained from
c_str(): "const charT* c_str() const; [...] Requires: The program shall not
alter any of the values stored in the array. [...]" (There is a reason why
c_str() returns a pointer to _const_ char)
Probably your implementation uses copy-on-write and you screw things up;
technically you have undefined behavior anyway.
Markus