Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created April 30, 2017 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deque-blog/9d1f49bf178b0fb52a6fe797298ba0a2 to your computer and use it in GitHub Desktop.
Save deque-blog/9d1f49bf178b0fb52a6fe797298ba0a2 to your computer and use it in GitHub Desktop.
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