Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
template<typename Number, size_t N>
constexpr Number average(std::array<Number, N> const& vals)
Number total = 0;
for (int i = 0; i < N; ++i)
total += vals[i];
return total / N;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment