“How bad is Meta-Programming still today?"
summary
A fast survey of C++ compile-time programming that shows what actually works: classical template metaprograms (prime test, Fibonacci) compile with old compilers and once infamously cause days of build time and megabyte-scale error output (GCC 4.5 example with ~18 MB messages), while constexpr in C++14 lets the same algorithms become readable, handle floats and user types, and be evaluated at compile time or runtime. Demonstrates expression templates for zero-temporary arithmetic, meta-tuning via unrolling, and proves constexpr are Turing-complete; practical tradeoffs and compiler limits are measured and discussed.
AI-written summary · about
chapters (24)
- 0:00Intro
- 4:29Disillusion
- 7:27Fibonacci Numbers
- 10:17Testing for Prime Numbers
- 12:22Benefits of constexpr
- 13:46Example: Template Square
- 18:43Equivalence of constexpr Computability
- 21:20Type Traits
- 24:17Semantic Tests
- 25:45Trait for mixed-type Operations
- 29:00Availability with enable if
- 30:40Function selection with enable if
- 32:41Elegance vs. Performance
- 36:06Expression Templates: Elegance and Performance
- 42:03Loop Unrolling Hope for the Compiler
- 43:01Loop Unrolling Do it Yourself
- 44:03Unroll Loops of Variable Length
- 44:17Parameterized Unrolling
- 46:24API and Performance
- 50:02Computability of Template Meta-Programs
- 50:44Computability of constexpr
- 51:50Recursive Functions Composition
- 53:20Recursive Functions: Minimalization
- 55:27The Turing Completeness
related talks
01h 06m“C++ Metaprogramming: Journey from simple to insanity and back"
01h 00mModern Template Metaprogramming: A Compendium, Part I
57mIntroduction to C++ Template Metaprogramming
58mExploration of C++20 Meta Programming
01h 48m“Meta: Thoughts on generative C++”
51mC++: How I learned to stop worrying and love metaprogramming
01h 01mRethinking the Way We Do Templates in C++
01h 01mMeta
