~/talk

Class Template Argument Deduction for Everyone

Talkat CppCon 2018 · 2018-09-23..09-28· [c-and-cpp]
links:none on file
slides:none on file

C++17’s Class Template Argument Deduction (CTAD) automatically infers template parameters for many STL types (std::pair, std::array, std::vector, lock guards), cutting angle-bracket noise; the library implements this with explicit deduction guides where constructors don’t name all template parameters and uses the decay by value trick to match perfect-forwarding constructors. Limitations include alias templates, explicit template-argument mixes, nullptr and non-deduced-context edge cases, and aggregate rules for std::array; MSVC/Clang implemented CTAD in practice and uncovered compiler bugs during rollout.

AI-written summary · about

  1. 0:00Intro
  2. 1:32Why Examples Use STL Types
  3. 2:52Function Template Arg Deduction
  4. 5:14Class Templates: No Deduction
  5. 13:56Type Transformation
  6. 19:14Alias Templates
  7. 28:11Range Constructors
  8. 28:48Hello, Deduction Guide World
  9. 35:11Enforcing Requirements
  10. 36:45Supporting CTAD in Your Library - For each constructor of each class template: - Is CTAD applicable? Example "no": vector size_t Does CTAD automatically work?
  11. 45:14Deduction Guides, 1 of 3
  12. 49:35Non-Templated Constructors
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.