~/talk

C++ Variadic Templates and Parameter Packs

Talkat C++ on Sea 2025 · 2025-06-23..06-25· [c-and-cpp]
links:none on file
slides:none on file

Refresher on using C++ variadic templates and parameter packs with concrete examples: a tuple-backed container implemented by expanding packs into template and ctor argument lists, a constexpr make_array sized with sizeof..., a sum implemented first via initializer_list then simplified to a one-line fold expression in C++17, a delete_all and find_first_if built with folds and comma tricks, an overload combiner for lambdas using tuple-like base expansion, plus use of std::apply, std::forward, std::variant/std::visit, concepts (C++20) and planned C++26 features like direct pack indexing and variadic structured binding.

AI-written summary · about

  1. 0:00Variadic templates intro
  2. 1:12C++ templates refresher
  3. 4:41What variadic templates enable
  4. 7:12Parameter pack expansion example
  5. 10:48Forwarding with parameter packs
  6. 12:35Compile-time pack size
  7. 13:59Packs in initializer lists
  8. 16:09Operations on each pack element
  9. 18:19Packs in lambda captures
  10. 20:54Alignment expansion for variants
  11. 23:03std::visit with lambdas
  12. 26:00Recursive vs initializer packs
  13. 27:03C++17 fold expressions
  14. 31:23Fold expressions with operators
  15. 32:50delete_all with fold
  16. 34:59Complex fold logic
  17. 37:56Type lists for packs
  18. 39:02Scheduler example
  19. 41:12C++11 to C++17 evolution
  20. 44:24Standard library pack tools
  21. 46:13C++20 abbreviated templates
  22. 47:41Same-type enforcement with concepts
  23. 49:05C++26 pack future
  24. 50:32Variadic structured binding
  25. 52:46Substitution failure
~/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.