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_
It could be because of string pooling. Neverthless, it is Undefined behavior. We should not use the c_str() output once the string goes out of scope.