Hi Mathias,
 
> 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?
Like 
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...

Thanks,
Maxim
_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to