Skip to content

Instantly share code, notes, and snippets.

@usagi
Created January 13, 2014 07:35
Show Gist options
  • Select an option

  • Save usagi/8396104 to your computer and use it in GitHub Desktop.

Select an option

Save usagi/8396104 to your computer and use it in GitHub Desktop.
#include <algorithm>
#include <vector>
#include <iostream>
int main()
{
using namespace std;
vector<int> vs{0,1,2,3,4,5,6,7,8,9};
auto i = copy_if(begin(vs), end(vs), begin(vs), [](int v){ return v%2==0; });
vs.resize(distance(begin(vs), i));
for(auto v: vs)
cout << v << " ";
}
@usagi

usagi commented Jan 13, 2014

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment