When are range-based for loops better than regular for loops?
In my experience, if you don't need an index variable and don't need to iterate over the objects in a particular order, then range-based for loops can be easier to understand, and less verbose. Outside of those conditions, it's usually a matter of taste. You're basically saying, "for each object in the container, do this," as opposed to saying, "for each index in the container, retrieve the object at the index, and for each object you've retrieved, do this."