Simplify code with automatic type deduction and cleaner loop syntax.
Two of the most frequently used and appreciated features of modern C++ are the `auto` keyword and range-based `for` loops. The `auto` keyword instructs the compiler to automatically deduce the type of a variable from its initializer. For example, instead of writing `std::vector<int>::iterator it = myVector.begin();`, which is verbose and prone to typos, you can simply write `auto it = myVector.begin();`. The compiler knows the type returned by `.begin()` and assigns it to `it`. This makes the code significantly cleaner, more readable, and less brittle to changes (if the container type changes, you don't have to update the iterator type). The range-based `for` loop provides a simplified syntax for iterating over all the elements in a range, such as an array, an STL container, or any other object that has `begin()` and `end()` methods. Instead of the traditional iterator-based loop, `for (auto it = vec.begin(); it != vec.end(); ++it)`, you can write `for (const auto& element : vec) { ... }`. This loop will iterate through each `element` in the `vec` container. Using `const auto&` is a common and efficient pattern: `auto` deduces the type, `&` makes it a reference to avoid a potentially expensive copy of the element, and `const` ensures you don't accidentally modify the element inside the loop.