auto is a keyword that has different meanings, depending on the standard used:
In the C++11 Standard, auto is useful to let the compiler determine a variable's data type
auto as described in the ISO/IEC 14882:2003 C++ Standard is a keyword to specify that a locally declared variable is destroyed at the end of its scope. In other words: to specify to do, what already will be done. In C++98, never write auto [1]
- Use auto to avoid verbosity and typos when you use iterators [2]
- Prefer auto to explicit type declarations [3]
- Prefer the = syntax for the initialization in declarations using auto [5]
- Remember that auto + { expr } == std::initializer_list [4]
- In C++98, never write auto [1]
- Herb Sutter. Exceptional C++ style. 2005. ISBN: 0-201-76042-8. Item 28 guideline: 'Never write auto'.
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 31.6. Advice. page 924: '[17] Use auto to avoid verbosity and typos when you use iterators'
- Scott Meyers. C++ And Beyond 2012 session: 'Initial thoughts on Effective C++11'. 2012. 'Prefer auto to Explicit Type Declarations'
- Scott Meyers. C++ And Beyond 2012 session: 'Initial thoughts on Effective C++11'. 2012. 'Remember that auto + { expr } == std::initializer_list'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 6.6. Advice, page 169: '[20] Prefer the = syntax for the initialization in declarations using auto'