Boost logo

Boost :

From: me22 (me22.ca_at_[hidden])
Date: 2005-11-17 21:55:03


On 17/11/05, John Maddock <john_at_[hidden]> 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


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