Skip to content

auto and decltype ​

auto is not just a lazy shortcut for skipping type names — it has complete deduction rules of its own, proxy-type pitfalls, and semantics that stay consistent with template argument deduction. decltype is the cornerstone of template metaprogramming, letting us capture an expression's type exactly. C++17's CTAD then makes template argument deduction more concise than ever. In this chapter we thoroughly sort out the three dimensions of type deduction: auto, decltype, and CTAD.

Chapter Contents ​

pdf-latest-4-g85128cc · 85128cc · 2026-10-05