Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created December 22, 2016 21:54
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/b5edad5a765933db6fba82ab761e9a42 to your computer and use it in GitHub Desktop.
Save deque-blog/b5edad5a765933db6fba82ab761e9a42 to your computer and use it in GitHub Desktop.
template<typename Iterator, typename Value, typename Accumulator>
Value accumulate_iter(Iterator first, Iterator last,
Value val, Accumulator fct)
{
for (; first != last; ++first)
val = fct(val, first);
return val;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment