Refactorization with auto

Let's see if we can refactor existing code to work with auto instead of explicit type declarations.

Problems with refactoring data types #

auto supports the refactorization of our code very well. First, it’s very easy to restructure our code if there is no type information.

Second, the compiler automatically takes care of identifying the right types. What does that mean? We will see the answer in the form of a code snippet. To start, here’s the code without auto:

Get hands-on with 1200+ tech skills courses.