I've read here and other places that when iterating a std::vector using indexes you should:
std::vector <int> x(20,1);
for (std::vector<int>::size_type i = 0; i < x.size(); i++){
x[i]+=3;
}
But what if you are iterating two vectors of different types:
std::vector <int> x(20,1);
std::vector <double> y(20,1.0);
for (std::vector<int>::size_type i = 0; i < x.size(); i++){
x[i]+=3;
y[i]+=3.0;
}
Is it safe to assume that
std::vector<int>::size_type
is of the same type as
std::vector<double>::size_type
?
Would it be safe just to use std::size_t?
Thanks.