Created
January 26, 2014 10:58
-
-
Save erogol/8631128 to your computer and use it in GitHub Desktop.
extract a sub-vector from given c++ vector, example code
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 <vector> | |
| #include <iostream> | |
| using namespace std; | |
| int main(){ | |
| // This initialization is available at C++11 support compiler | |
| // For lower version C++ support check the reference document | |
| vector<int> arr (9); | |
| arr = {1,2,3,4,5,6,7,8,9}; | |
| vector<int>::const_iterator begin = arr.begin(); | |
| vector<int>::const_iterator last = arr.begin() + arr.size(); | |
| vector<int> new_arr(begin+1, last); | |
| cout << "Size: "<< new_arr.size() << endl; | |
| for (int i = 0 ; i < new_arr.size(); i++){ | |
| cout << new_arr[i] << endl; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are SV cable connectors used in homes to watch out over home, while owner is away. If you do a little shade tree mechanic work on a TV/VCR combo, and hook up a sub vector connector to TV I've been told that the TV VCR combo will send videos of empty house to owner. Is that really true?