~/talk

CTAD: Complete Guide to Class Template Argument Deduction

Talkat ACCU 2024 · 2024-04-17..04-20· [c-and-cpp]
links:none on file
slides:none on file

C++17’s class template argument deduction (CTAD) lets the compiler infer template parameters from constructors by creating implicit deduction guides derived from the primary template, and C++20/23 extend that to aggregates support and inherited constructors. It fails for references, arrays, partial explicit template arguments (you cannot supply some and have others deduced), and some non-deduced contexts. User-written guides override implicit ones; never declare guides for std types. Note the copy-preference (copy-style guides often win over converting constructors). Test, document, and add explicit guides when library behaviour must be precise.

AI-written summary · about

  1. 0:00Introduction to CTAD
  2. 2:58Motivations for the Talk
  3. 4:22Function Template Deduction
  4. 8:57Class Template Deduction
  5. 11:42CTAD Use Cases
  6. 14:41CTAD in Ranges
  7. 17:31CTAD Evolution
  8. 20:57CTAD Capabilities
  9. 24:16Structural Types
  10. 26:54How CTAD Works
  11. 30:02Implicit Deduction Guides
  12. 37:19User-Defined Guides
  13. 39:24Guide Rules and Pitfalls
  14. 44:13CTAD vs Forwarding
  15. 49:23Limitations of CTAD
  16. 54:55CTAD Preferences
  17. 59:49Handling Edge Cases
  18. 1:03:55Conclusion and Q&A
~/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.