~/talk

Back to Basics: Templates (part 2 of 2)

Talkat CppCon 2020 · 2020-09-14..09-18· [c-and-cpp]
slides:none on file

Walks through concrete template recipes: a variadic min function that unpacks a parameter pack and uses recursion guarded by constexpr if, then replaces that recursion with uses fold expressions and a comma-separated lambda to print arbitrary args; a build_csv_line that normalizes mixed string/value types into std::string at compile time; a mac-address equality implemented with std::make_index_sequence to compare array elements; SFINAE vs tag-dispatch vs Concepts shown with working examples; demonstrates that C++20 templated lambdas shrink a 27-line solution to shows 27→13 lines with C++20 and keeps behavior identical.

AI-written summary · about

  1. 0:00Introduction
  2. 3:45Variatic Templates
  3. 11:00Normalized Templates
  4. 18:15Fault Expressions
  5. 25:33Templates vs overloads
  6. 27:52Fall expressions
  7. 31:38Comparing data structures
  8. 34:50Comparing in 27 lines
  9. 40:55lambdas
  10. 42:02variable templates
  11. 43:37variable template
  12. 45:11substitution failure
  13. 47:37fini
  14. 51:45tact dispatch
  15. 53:44cbsline
  16. 57:26requires
  17. 59:11template parameters
~/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.