|
Boost : |
Subject: Re: [boost] [proto] RValue reference support?
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-08-11 11:19:46
> No, unfortunately.
> I think Eric said that for C++0x, it would be nice to rewrite a lot of
> things to make them simpler and faster to compile.
>
> I think it would be a useful addition in the current Proto without
> re-writing all of it though.
>
> I suspect however that if you don't rely on the default operator overloads
> and call make_expr yourself, it might work.
>
>
>> I'm thinking that if you know that you're assigning an expression
>> involving an rvalue-reference as a terminal, then there are some
>> optimizations that can be performed that aren't otherwise possible.
>
> Do you have an example of a DSL where that would be useful?
Well actually.... now I come to think of it some more, I'm not sure it's as
useful as I first thought: a nice "luxury feature" maybe, but not essential.
The example is the archetypical "big number" class - the idea is to minimize
the number of temporaries created while evaluating an expression - not just
removing "return by value from operator" that expression templates provide
by default, but to analyze the expression, figure out a [semi-]optimal
evaluation order and reuse temporaries as far as is possible.
But I'm figuring that the occurrence of temporaries on the RHS of an
expression, while not out of the question, is rare enough not to be too
concerned about.
Thanks for the prompt response, John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk