Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
template<typename Container>
int average(Container const& coll)
{
return std::accumulate(begin(coll), end(coll), 0, std::plus<int>{}) / coll.size();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment