~/talk

Compile-Time Counter Using Template & Constexpr Magic

Talkat CppCon 2015 · 2015-09-21..09-25· [compilers-and-language-design, c-and-cpp]
name:B. Geller
links:none on file
links:none on file
slides:none on file

A zero-overhead compile-time counter implemented with templates, constexpr and overload resolution that auto-increments via chained static methods triggered from a class default initializer; it uses a templated integer wrapper and decltype trick so decltype(expression) sees newly declared overloads during class completion. Registration is emitted by macros into CS registerN calls, optimized by clang into a single tail-call sequence (tail-call optimized) while GCC leaves distinct functions; works within C++11, has a 255 wrapper limit on clang unless adjusted.

AI-written summary · about

  1. 0:00Introduction
  2. 0:34The Problem
  3. 8:01The Standard
  4. 9:21Optimization
  5. 11:15Outro
~/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.