Last active
April 30, 2017 14:22
-
-
Save deque-blog/cc645cc501ca465935343cbbaf9e8da7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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