Created
January 13, 2014 07:35
-
-
Save usagi/8396104 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 << " "; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://melpon.org/wandbox/permlink/GXGQDFb7QIqmXhUD