Boost logo

Ublas :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2006-06-16 09:43:53


Note that I didn't try if this really works but since for_each makes a copy
of the supplied functor, I strongly suspect that this will help you.

Fernando Herrero Carrón wrote:

...

> Accumulator ac;
> std::for_each(l.begin(), l.end(), ac);
ac = std::for_each(l.begin(), l.end(), ac);
> std::cout << ac.get_sum() << std::endl;

...

HTH, Markus