Boost logo

Boost Users :

Subject: Re: [Boost-users] [Bind] Unexpected behavior when binding constchar* to function
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-04-28 21:46:11


On Wed, Apr 28, 2010 at 7:04 PM, Kim Barrett <kab.conundrums_at_[hidden]> wrote:
> 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 <kab.conundrums_at_[hidden]> wrote:
> 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.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net