
On 17/11/05, John Maddock <john@johnmaddock.co.uk> wrote:
I don't know if there is an accepted term, but it sounds a little like an "accumulator".
Well, I'm no math/cs expert, but I like the accululator name, since it seems very much like an alternate interface to std::accumulate. It might be nice to have these accumulators be able to act either as predicates or the initial value for std::accumulate; perhaps something along the lines of one the following: double average = std::accumulate( cont.begin(), cont.end(), 0.0, boost::accumulator< boost::arithmetic_mean<double> >() ); double average = std::accumulate( cont.begin(), cont.end(), boost::accumulator< boost::arithmetic_mean<int, double> >() ).value(); Although the first looks like it'd have some efficiency issues, and the second one isn't the nicest interface and could have some copying problems, but I'm sure there's someone here smarter than me that can make it work :P - Scott McMurray