2. Prior to C++11, auto was a storage class
specifier.
C++11: Specifies that the type of the
variable that is being declared will be
automatically deduced from its initializer.
5. We can place * in pointer declarations.
p1 and p2 are of type int *
Programming with Sikander : Modern C++ 5
6. Programming with Sikander : Modern C++ 6
We can also declare multiple variables in a
single auto declaration statement
In such case, the type of each declarator can be
deduced independently.
If the deduced type is not the same in each
deduction, the program will throw an error.
7. The keyword auto can be accompanied by
modifiers, such as const or &(reference),
which will participate in the type deduction
7
Programming with Sikander : Modern C++
14. Robustness: If the expression’s type is changed—
this includes when a function return type is
changed—it just works.
Performance:You’re guaranteed that there will be
no conversion.
Usability:You don't have to worry about type name
spelling difficulties and typos.
Efficiency:Your coding can be more efficient.
Programming with Sikander : Modern C++ 14
15. The auto keyword cannot be combined with
any other type-specifier.
A symbol that is declared with
the auto keyword must have an initializer.
All the symbols in a declarator list that is
declared with the auto keyword must resolve
to the same type
Programming with Sikander : Modern C++ 15
16. Auto can be applied to parameters of
function.
Auto can be used as return type of function.
Programming with Sikander : Modern C++ 16