> The scenario is
> terminal a, b, c, r;
> auto tmp = a*b*c;
> r = tmp + tmp;
> Assuming everything is held by reference, when used in r, tmp will
> refer to a dangling reference (the a*b node).
This is asking for trouble I think.
What about using something like boost::phoenix::let, to explicitly say we have
a common subexpression?
r = let( tmp = a*b*c )[ tmp + tmp ];
BTW, I remember there was a discussion about "explicit auto" - was there any
movement in that direction?
It could give some protection here...
proto mailing list