Skip to content

Instantly share code, notes, and snippets.

@mashiro
Created December 15, 2009 07:52
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 mashiro/256767 to your computer and use it in GitHub Desktop.
Save mashiro/256767 to your computer and use it in GitHub Desktop.
#include <algorithm>
#include <vector>
#include <iostream>
int main()
{
std::vector<int> v;
for (int i = 0; i < 10; ++i) v.push_back(i);
struct { void operator ()(int n) { std::cout << n << std::endl; } } f;
std::for_each(v.begin(), v.end(), f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment