: If Elias later changes the data structure from a vector to a list , he doesn't have to manually update every single type declaration; the auto keyword handles it automatically.
: The focus is now on the action (the loop) rather than the technical type name.
However, Elias has to be careful. As some developers have discovered, using auto without specifying it as a reference (like auto& ) can sometimes lead to the compiler making a of the data instead of just looking at the original, which can cause performance issues or bugs in "convenience gone wrong" scenarios. Convenience Gone Wrong: A C++ auto Story