~/talk

Back to Basics: Templates (part 1 of 2)

Talkat CppCon 2021 · on Tuesday, 2021-10-26· at 14:00· online· [typescript]
links:none on file
slides:none on file

Part 1 explains concrete mechanics: templates are recipes that the compiler parses in phase 7 parses templates and generates in phase 8 instantiates them. Examples show where templates beat old C patterns (qsort comparator casts that silently fail) and when to use explicit instantiation to cut compile time or export instantiations from a DLL. Covers function/class/alias/variable templates, non-type and template-template parameters, explicit specialization for char const* comparisons, and ODR rules.

AI-written summary · about

  1. 0:00Start
  2. 2:31Features of Templates
  3. 2:43References
  4. 4:02What Are Templates and Why Do We Have Them in the Language
  5. 4:23Function Overloading
  6. 5:08A Singly Linked List
  7. 6:01Type Erasure
  8. 6:15Qsort
  9. 8:30Reusing Code That Used Macros
  10. 10:01Generic Programming
  11. 11:02Lift Algorithms and Data Structures from Concrete Examples to Their Most General and Abstract Form
  12. 12:03Template Categories
  13. 13:18Class Templates
  14. 14:31Example of a Member Function Template
  15. 15:38Alias Templates
  16. 17:23General Row Vector
  17. 17:58Variable Templates
  18. 20:44Initialized Fill
  19. 21:27Lambda Templates
  20. 26:23Translation Units
  21. 27:22Translation Unit
  22. 27:49Syntax Analysis
  23. 28:31Sample Translation Unit
  24. 29:31Declarations and Definitions
  25. 32:46Template Declarations and Definitions
  26. 33:44Member Function Declaration
  27. 36:55Template Parameters and Template Arguments
  28. 38:37Type Template Parameters
  29. 39:12Template Template Parameters
  30. 44:02Template Ids
  31. 44:29From Template to Specialization
  32. 47:04The Relationships between Instantiation and Specialization
  33. 47:49Instantiation
  34. 48:39Implicit on-Demand or Automatic Instantiation
  35. 50:59Implicit Instantiation
  36. 51:24Explicit Instantiation
  37. 51:48Explicit Instantiation Request
  38. 52:49Instantiate Individual Member Functions
  39. 55:04Explicit Instantiations
  40. 55:22Some Real World Uses for Explicit Instantiation
  41. 56:24Shared Libraries or Dlls
  42. 57:02Explicit Specialization
  43. 59:57Relationships between Instantiation and Specialization
~/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.