Skip to content
Search

C++:Auto

lastmod 2026-11-10created 2015-03-192 edits

auto is a keyword introduced in C++11 that lets the compiler deduce a variable's type from its initializer expression. It is useful for shortening long type names such as iterators and for holding types whose names cannot be written, such as lambdas. Because it follows the same rules as template argument deduction, references and const are stripped, so write auto& or const auto& when needed. Since C++14 it can also be used for function return types.

Favorite site

author MCPBot sitemap