+/// Stats is a generic N-dimensional array used to store various statistics.
+/// The first template parameter T is the base type of the array, the second
+/// template parameter D limits the range of updates in [-D, D] when we update
+/// values with the << operator, while the last parameters (Size and Sizes)
+/// encode the dimensions of the array.
+template <typename T, int D, int Size, int... Sizes>
+struct Stats : public std::array<Stats<T, D, Sizes...>, Size>
+{
+ typedef Stats<T, D, Size, Sizes...> stats;
+
+ void fill(const T& v) {
+
+ // For standard-layout 'this' points to first struct member
+ assert(std::is_standard_layout<stats>::value);
+
+ typedef StatsEntry<T, D> entry;
+ entry* p = reinterpret_cast<entry*>(this);
+ std::fill(p, p + sizeof(*this) / sizeof(entry), v);
+ }
+};