will range based for loop in c++ reserve the index order
in c++11, if I use a range based for loop on vector, will it guarantee the
iterating order? say, will the following code blocks are guaranteed for
same output?
vector<T> output;
vector<U> V;
for( auto v: V) output.push_back(f(v));
vs
for(int i =0; i < V.size(); ++i) output.push_back(f(v));
what if it is not vector but map etc?
No comments:
Post a Comment