Boost logo

Boost :

Subject: Re: [boost] [operators] The Dangling Reference Polarization
From: Andrew Ho (helloworld922_at_[hidden])
Date: 2013-04-25 18:21:24


Daniel Frey <d.frey <at> gmx.de> writes:

> Your example suggests you tested with std::string, which works for me with
GCC. But I guess you are
> suggesting that with an operator+ returning an rvalue reference, it would
fail. And indeed this is the
> first example which makes sense to me. It has all the properties I was
looking for:
>
> - It's common
> - The binding of the result is implicit
> - The code doesn't have a bad code-smell, it looks reasonable
>
> Mist. (That's the German "Mist", not the English one ;)
>
> Let me think about it for a while…
>
> Best regards, Daniel

Yes, I'm not using std::string but a custom string implementation.

p.s. I asked a question on the msdn forums to understand why their
implementation properly (or improperly, depending on your point of view)
extends the lifetimes of the temporaries. link:
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/3c754c4e-5471-
4095-afae-795c1f411612


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk