|
Boost : |
Subject: Re: [boost] [GSoC][Phoenix3] Regarding mutability of arguments passed to phoenix expressions
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-04-28 13:19:57
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...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk