Skip to content

Instantly share code, notes, and snippets.

@1995hnagamin
Last active June 19, 2016 05:52
Show Gist options
  • Save 1995hnagamin/7908a78eeb460fbfb91aad57b59eb6ac to your computer and use it in GitHub Desktop.
Save 1995hnagamin/7908a78eeb460fbfb91aad57b59eb6ac to your computer and use it in GitHub Desktop.
#include <iostream>
#include<vector>
#include<algorithm>
#include<iterator>
int main() {
std::vector<int> v = {0,1,2,3,4};
std::vector<int> w;
std::copy(v.begin() + 1, v.begin() + 4, std::back_inserter(w));
for (int n : w) {
std::cout << n << std::endl;
}
/*
1
2
3
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment