I'm looking for a small header-only library which takes a C++ container (or range, or iterator pair) with numbers, and gives you some basic stats about it: average, variation, kurtosis, standard deviation, standard error, order statistics (e.g. quartiles and deciles), mode, support set cardinality - these sorts of things.

This is of course not difficult to write yourself (and a bit of it is in the standard library anyway); so somebody must have written something like up nicely.


  • Header-only
  • Modern C++'ish, i.e. no weird virtual stuff, macro-based metaprogramming etc.
  • Non-restrictive license: 3-BSD, ASL, MIT or such
  • Maintained
  • Gratis
  • Platform-independent


  • Single header file

1 Answer 1


I can only think of Boost.Accumulators by Eric Niebler, but while it itself is header only, it has a lot of Boost dependencies which might be a bit heavyweight for your use-case. Especially I'm not sure if Boost is "Modern C++'ish" enough for you as it was originally written pre-C++11.

One pro is certainly that it allows to calculate multiple of these stats in one go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.