/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 2010 Danny Robson */ #pragma once #include #include namespace cruft { namespace stats { // Undefined until at least one value has been added. template struct accumulator { accumulator (); void reset (void); void add (T); void add (const accumulator &); size_t count; T min; T max; T sum; T range (void) const; T mean (void) const; }; template std::ostream& operator<< (std::ostream&, const accumulator&); } } template struct fmt::formatter> { constexpr format_parse_context::iterator parse (format_parse_context &ctx) { return ctx.begin (); } format_context::iterator format (cruft::stats::accumulator const&, format_context &ctx) const; };