Skip to content

Instantly share code, notes, and snippets.

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