Re: lifetime of objects (here: strings)
On Apr 12, 3:05 pm, "Alf P. Steinbach" <al...@start.no> wrote:
* James Kanze:
On Apr 11, 5:19 pm, r...@zedat.fu-berlin.de (Stefan Ram) wrote:
James Kanze <james.ka...@gmail.com> writes:
Exact. But the effect is not transitive; the lifetime is
only extended to match the reference initialized with the
temporary, not to other references which were initialized
from that reference.
string const & my_string3( my_string1 + my_string2 );
I am trying to construct an example where this
intransitivity can be seen.
std::string const f( std::string const& arg )
{
return arg ;
}
Typo, you meant
std::string const& f( std::string const& arg )
Yes?
Yes. Thanks for the correction.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34