Expose a reset method for stats accumulator

This commit is contained in:
Danny Robson 2012-08-07 18:34:36 +10:00
parent 2993d27ea8
commit c0dbf6936d
2 changed files with 15 additions and 6 deletions

View File

@ -24,12 +24,19 @@
template <typename T> template <typename T>
util::stats::accumulator<T>::accumulator (): util::stats::accumulator<T>::accumulator () {
count (0), reset ();
min (std::numeric_limits<T>::max ()), }
max (std::numeric_limits<T>::min ()),
sum (0)
{ ; } template <typename T>
void
util::stats::accumulator<T>::reset (void) {
count = 0;
min = std::numeric_limits<T>::max ();
max = std::numeric_limits<T>::min ();
sum = 0;
}
template <typename T> template <typename T>

View File

@ -31,6 +31,8 @@ namespace util {
struct accumulator { struct accumulator {
accumulator (); accumulator ();
void reset (void);
void add (T); void add (T);
void add (const accumulator<T> &); void add (const accumulator<T> &);