Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-04-10 12:00:23


shunsuke wrote:
> Eric Niebler wrote:
>>> As shown above, lvalue/rvalue-ness doesn't guarantee the complete safety.
>> I think your argument is specious.
>
> I just show a counter-example.
> It might not be a real use case, though.
> I think
>
> int i;
> /* perform elaborate calculations for i. */
> return make_tuple(rvalue(i));
>
> seems odd.

I actually agree. I've looked again at fusion::make_tuple and I see I
misremembered its behavior. It always stores arguments by value unless
the argument is a reference_wrapper. That seems reasonable, even in C++0x.

So maybe I'm coming around to thinking that function objects that do
something different with lvalues and rvalues are always a bad idea, even
in C++0x. Not sure yet what the implications are for proto transforms.

-- 
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