I have a doubt on basic C++ usage. The code below, compiled with gcc/LInux, prints out correctly.
The string test goes out of scope so also its c_
test
c_
While the string object goes out of scope, the memory pointed to by a will still be there. I don't think the standard says anything about clearing the actual memory locations when a string is destructed.
string
a