On Wed, Apr 28, 2010 at 7:04 PM, Kim Barrett
21.3.6/2: ... Nor shall the program treat the returned value as a valid pointer value after any subsequent call to a non-const member function of the class basic_string that designates the same object as this.
Yes, that, thanks, typing emails from my now malfunctioning phone is
not easy, so I could not check what the standard says. I always
treated it based on termination points anyway, so I was in the
better-safe-then-sorry camp. :)
On Wed, Apr 28, 2010 at 7:04 PM, Kim Barrett
So anything that can modify the contents of the string (including things like its size and capacity, and also including destruction), and only those things, invalidates the c_str() result.
But the general point that OvermindDL1 and others are making is correct: one needs to be aware of lifetime issues and what the interface one is using specifies in that regard.
Yes, that is what I was demonstrating, really should learn C/C++ 101 first.