John Maddock wrote:
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 !!!!!!!!
I would support the need for such a library as I have ended up writing something similar to this for nearly every project I have undertaken.
...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.
IMHO that is the right approach.
* 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.
Just think of the uses for processing stats and network stats in high reliability systems... Can't wait :-) Jim