Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-04-08 16:39:18


Daniel Walker wrote:
> I don't see the motivation for Proto to attempt to distinguish
> rvalues and lvalues in C++03. Is there some dangling reference issue
> that I'm missing?

Yes, there's a dangerous dangling reference problem. There are
expression trees, and transforms that manipulate the trees. Some
transforms create new nodes and graft them onto existing trees. Some
transforms just rearrange existing nodes. The former create rvalue
nodes, which /must/ be stored by value by their parents. The later are
just rearranging lvalue nodes, which should be stored by reference by
their parents (to avoid needless copies). So, the behavior of a
transform depends very much on whether it is passed rvalues or lvalues.

That's kind of hand-wavy, but it should give you the idea.

> BTW, Eric, congrats on Proto's acceptance! If I had written a review
> it would have been positive, but I've been out of it for many moons.
> ;-)

Thanks.

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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