Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-03-20 11:28:34

> 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) ) );
> ^^^^^^^^^^^^^
var(v.back() )
will store a reference to the result of the call to v.back() which gets
evaluated once.
So in effect, the last entry of v (did you mean "grades?"), will contain the
sum of bind(...blah blah). Or did you mean bind(vector<grades>::back, v) +=
(and at this moment, I'm not sure that this even works. I think it should
but its been a while since I've written this sort of stuff.)

> 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".
Ok. I'll pass this on and let you know what we come up with. I don't have
any problem with duplicate names here.

What I want to avoid is
  lvalue(v) += rvalue(20) + lvalue(f)

and have to explain that while the "rvalue" call is to the left of "+" it's
really returning a constant expression, and that the "lvalue" is to the
right of "+" its returning a reference to f. Seems to add more confusion
than it clears up. (But then that's me and I don't have a formal CS



Boost list run by bdawes at, gregod at, cpdaniel at, john at