constexpr: Introduction
summary
Covers how constexpr moves computations into compilation: use constexpr functions and values, static_asserts, recursion to build a compile-time binary literal, constexpr constructors with bodies in C++14, and debugging tricks (run the same code at runtime, or force a link-time error by referencing an unresolved symbol inside a throw). Notes practical wins for embedded and thread-safe constant containers, warns that compile vs runtime FP may differ, and cites Annex B minima like 512 recursive invocations and over a million full expressions.
AI-written summary · about
chapters (10)
- 0:00Introduction and setup
- 10:07What is constexpr
- 22:00constexpr values and literals
- 32:04constexpr functions basics
- 44:45C++11 constexpr constraints
- 49:09C++14 constexpr improvements
- 53:58Compile-time parsing example
- 57:08Debugging constexpr code
- 1:00:24Runtime vs compile-time errors
- 1:03:58Q&A and summary
related talks
01h 09m“Compile-time programming and reflection in C++20 and beyond”
01h 03mOLD VERSION: Understanding The constexpr 2-Step
50mC++ Costless Abstractions: the compiler view
01h 00mRemoving Metaprogramming From C++, Part 1 of N: constexpr Function Params
01h 03mUnderstanding The constexpr 2-Step
01h 01m“How bad is Meta-Programming still today?"
01h 10m“constexpr ALL the Things!”
01h 04m“Constant Fun"
