~/talk

Constructor Template Argument Deduction Best Practices

Talkat CppCon 2017 · 2017-09-24..09-29· [rust]
links:none on file
slides:none on file

C++17 constructor template argument deduction (CTAD) works but needs rules: use CTAD only when constructors do pure forwarding so code loses visual noise but not behavior, keep factory functions for helpers like make_tuple that unwrap reference_wrappers, add explicit deduction guides when the constructor needs nontrivial type synthesis (two iterator overloads → value_type), prefer parameter packs at the end of constructors to match function template syntax, and understand brace initialization chooses copy unless an initializer_list is explicit.

AI-written summary · about

  1. 0:00Introduction
  2. 0:28Elevator Pitch
  3. 1:21Vector from Initializer
  4. 2:28Deduction Rule
  5. 2:57Factory Functions
  6. 3:42Braces
  7. 4:12Copying
  8. 5:09Conclusion
~/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.