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?
Yes the two codes are guaranteed to do the same. Though I don't have a link to the standard you can have a look here. I quote: You can read that as "for all x in v" going through starting with v.begin() and iterating to v.end().