Skip to content

Instantly share code, notes, and snippets.

@audioplastic
Created November 29, 2012 21:32
Show Gist options
  • Save audioplastic/4172051 to your computer and use it in GitHub Desktop.
Save audioplastic/4172051 to your computer and use it in GitHub Desktop.
Test gist showing some C++11 niceness
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
vector<int> v{12,324,45,65,787,9}; //Uniform initialization
cout << "In vector: ";
for (auto val : v) {cout << val << ", ";} //Range based for
int m = 5;
cout<< "there are "
<< count_if(v.begin(), v.end(), [m](int i){return i%m == 0;}) //lambdas
<< " multiples of " << m << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment