C++ Snippet
auto and decltype Idioms
Difficulty: Easy
`auto` lets the compiler deduce a variable's type from its initialiser; `decltype` extracts the type of an expression for use in declarations. Together they make modern C++ much less verbose, especially for iterators, lambdas, and templates. This snippet covers the basic deduction rules, the difference between `auto` and `auto&`, and when to reach for `decltype` over `auto`.
