I'm doing an exercise to reverse the order of a vector. My program works, but I am getting a warning in the for loop I am executing below:
void reverse (vector<int>& v){
for(int i=0; i<v.size()/2; ++i){
swap(v[i],v[v.size()-1-i]);
}
}
on the line of the for loop, I am getting the warning message "comparison between signed and unsigned integer expressions [-Wsign-compare]". I am using Stroustrop's Programming Principles and Practice Using C++, and he uses basically that general format (without the / 2). Should I be writing this for-loop differently?