Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Last active October 6, 2017 11:02
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/a4337ea2dec26cc2e1631663572378fd to your computer and use it in GitHub Desktop.
Save deque-blog/a4337ea2dec26cc2e1631663572378fd to your computer and use it in GitHub Desktop.
template<typename T, typename Consumer>
void for_each(
typename std::vector<T>::const_iterator first, //dependent type on T
typename std::vector<T>::const_iterator last, //dependent type on T
Consumer consumer)
{
for (;first != last; ++first)
consumer(*first);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment