Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-20 11:09:00


> -----Original Message-----
> From: Gary Powell [mailto:Gary.Powell_at_[hidden]]
> Sent: Tuesday, March 20, 2001 9:57 AM
> To: 'boost_at_[hidden]'
> Subject: RE: [boost] Lambda on MSVC
>
>
> > >...or lvalue() and rvalue(). I like lvalue() better than
> var() du to my
> > >hatrd of abbrevs.
> >
> > Those are even clearer. And they are specific terms defined in the C++
> > standard, so in that sense are not abbreviations.
> >
> > --Beman
> >
> I think var() and constant() are clearer in meaning for a lambda
> expression.
> var() makes a variable into a lambda expression, and constant() evaluates
> the expression inside of () and makes a constant value out of it (constant
> as in not re-evaluated within the lambda expression.)
>
> int foo(int);
> int v;
> for_each(a.begin(), a.end(),
> (var(v) += bind(foo, var(v)) - free1 + constant(20) ) );
>
> vs.
> for_each(a.begin(), a.end(),
> (lvalue(v) += bind(foo, lvalue(v)) - free1 + rvalue(20) ) );
>
> But if you still want rvalue and lvalue I'll discuss it with
> Jaakko. What I
> want is a term that will be easily explained to a intermediate student of
> C++.

Yeah, but how do you explain this?

  vector<double> grades;
  ...
  for_each(a.begin(), a.end(),
         (var(v.back()) += bind(foo, lvalue(v)) - free1 + constant(20) ) );
       ^^^^^^^^^^^^^

Anyway, I like "variable" much better than var; I could live with just
"variable" for the lvalue case, but I also don't mind having "variable" and
"lvalue".

-Dave


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