I have some simple stuff in the sandbox under the "stat" directory. You can view its usage here:
Otto: first off we really need something like this, in Boost and in the std as well IMO. It really galls me that my desktop calculator has more math functions than <cmath> has, and wait for it: my calculator is 25 years old !!!!!!!! However, I'm not sure that either of us has the right interface yet: I'm particularly concerned that you're making these algorithms, it means that if you want to access more than one statistic you have to make multiple passes over the data. The advantage of the "make it an object" approach is that pretty much all stats you could want are accessible after a single pass over the data. More than that you can: * Pause at any time and read off the stats, and then continue adding more data if you want. * An extension of the above would be to make the stats object serialisable. * Two or more objects can be "added" together to obtain the stats for the combined data without reaccessing the original data: imagine a weather station gathering temperature data over time: hourly stats can be combined into daily or weekly stats without going back to the original data - which may be either discarded (unlikely) or stored in offline storage. Unfortunately: this method is prone to numerical overflow/underflow :-( Knuth has some fancy algorithms that I believe avoid that, but then you loose the simplicity and checkpointing/additive behaviour of the "scorecard" based system. So as usual, there ain't no free lunch! John.