Joel Falcou wrote:
Samll question, for a given eval_xpr, if I do :
eval_xpr()(x+y, state, data);
it seems that the operator()(Expr,State,Data) of the transform
require the Expr to be a reference and so, the former call fails as x+y
is a temporary. Is it on, purpose or is it a missing feature ?
eval_xpr gets an operator() overload defined by proto::transform that
looks like this:
template
....
operator ()(Expr &e, State &s, Data &d) const
----------------^^^^^^^
You are observing that the "Expr &e" is a non-const ref, and ordinary
rvalues do not bind to it. But the rvalues that Proto generates are all
const-qualified, which *do* bind to this reference. Notice that I used
"eval_xpr()(x + y)" in the example I sent around yesterday, and it works
there.
So the question is: why doesn't this work for you? Have you defined your
own operator+ overload? Could you send your code around again?
--
Eric Niebler
BoostPro Computing
http://www.boostpro.com