Skip to content

Instantly share code, notes, and snippets.

@gchavez2
Created August 11, 2018 15:24
Show Gist options
  • Save gchavez2/642fc656a19d06775d074a9782afa605 to your computer and use it in GitHub Desktop.
Save gchavez2/642fc656a19d06775d074a9782afa605 to your computer and use it in GitHub Desktop.
#include <vector>
#include <iostream>
using namespace std;
// Requires C++11 compiler
int main(int argc, char const *argv[])
{
vector<int> vec{5,7,2,32,9,45};
for_each(vec.begin(), vec.end(),
[](int &v) {
cout << v++ << " ";
});
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment