Boost logo

Boost :

From: Joel (joel_at_[hidden])
Date: 2004-11-27 00:32:20


Zhuo Qiang wrote:
>
> what about _a = var(arg1) which IMO is more explicit

I considered that syntax too. Unecessarily verbose, IMO.
The argN (like var(x)) already has reference semantics.
That is why you can write:

     ++arg1

for example, instead of the more verbose:

     ++var(arg1).

IMO, argN should always be implicitly an L-value, for
consistency.

>>>though the following code gives what I expect:
>>> int i = 1;
>>>
>>> let(_a = val(_1))
>>> [
>>> cout << --_a << ' '
>>> ](i);
>>> cout << i << endl;
>>
>>Exactly! args are L-values. vals are R-values.
>>
>>I'll emphasize that in the docs. Mind if I steal your example?
>
>
> Sure! As you wish.

Done :-)

Thanks!

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk