On 9/27/05, Stuart Dootson <stuart.dootson@gmail.com> wrote:
 
That's not going to work because the operator() call in the loop (i.e.
m(...)) is evaluated when the lambda expression is created, not each
time the lambda expression is evaluated.

Try replacing

var( m( c / m.w, c % m.w ) )

with

bind(&MyMatrix::operator(), var(m), var(c) / m->*&MyMatrix::w, var(c)
% m->*&MyMatrix::w)

This makes all accesses to m & c lazy (I think), so should update m as you want.

 Ok, that fixes it. Now, hardcore algorithmism aside, I don't see any advantage in this over the
for loop: it's slower, and can hardly be called an improvement in readability. So I think I'll stick to
the old-fashioned syntax in this case. Still, interesting to know that boost::lambda actually can do
this.

--
Alex Borghgraef