You are in a context where vthere is const. Use instead const_iterator.
for (std::vector<int>::const_iterator it = v.begin(); it != v.end(); ++it)
Note 1. autoWill do this automatically for you:
for (auto it = v.begin(); it != v.end(); ++it)
Note 2. You can use a range-based loop if you do not need access to the iterators themselves, but to the elements of the container:
for (auto elem : v)
source
share