
28 Apr
2010
28 Apr
'10
5:19 p.m.
Thomas Heller wrote:
Regarding arguments to phoenix expressions there are two possibilities. The first is: Arguments are mutable. The current phoenix is implemented to be able to this. Example:
int i( 1 ); ( ++phoenix::arg_names::arg1 )( i );
The result of ++phoenix::arg_names::arg1 will be 2, i will have the value 2 after the expression is evaluated.
That's the behaviour I want.
[2] ( ++phoenix::arg_names::arg1 + phoenix::arg_names::arg1 )( i );
The result of [2] will be 3. i still unchanged.
Even if `i' was passed by value, I would have expected 4, assuming left to right evaluation (which I think is the case here because it's an user-defined operator+). Otherwise you shouldn't be able to do ++phoenix::arg_names::arg1 in the first place...