~/talk

This One Weird Trick: std::integral_constant

Talkat CppCon 2019 · 2019-09-15..09-20· [c-and-cpp]
slides:none on file

Uses std::integral_constant to move computed values into types so recursion becomes compile-time and eliminates runtime calls even with no optimizations; demonstrates a Fibonacci implemented via type-level memoization that compiles fast and runs immediately. Shows using an auto return type to place results in return types, then extracting the value to avoid any function call. Builds an overload-based type map from integers to types and a get_common_size utility that returns std::optional filled when all sizes match (example: 2,2,2 → optional{2}, 2,2,3 → empty).

AI-written summary · about

  1. 0:00Start
  2. 1:56Overload Resolution
  3. 3:06Overload on Collections of Integral Constant
  4. 4:23Example Main Function
~/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.