loop through elements in vector c++ code example
Example 1: c++ iterate over vector
for(auto const& value: a) {
/* std::cout << value; ... */
}
Example 2: c++ looping through a vector
vector<int> vi;
...
for(int i : vi)
cout << "i = " << i << endl;