Use range-based for loops where it makes sense