i have a vector of vector “mydata”. i want to iterate my data in negative direction. the iterator should be started from the middle to the beginning.
i wish to use following way;
vector<vector<int> >::const_iterator points;
int i, k;
(lets assume k = 10)
for (i=k, points=mydata.begin()+k; i != -1; i--, points--){
//do stuff
}
does this way is the proper way to iterate in backward? (I am using dev c++, so predicates and some modern commands cant be used.)
Hope your suggestions to do this.
Since it’s vector, you dont need to use iterator at all:
Example:
output: