Implementing `static` control flow in C++14
summary
Shows a concrete C++14 implementation of compile‑time branching and looping: a static_if implementation using generic lambdas, variable templates and std::integral_constant, plus a recursive static_for with accumulator that exposes index, break/continue and returns a compile‑time value. Code lives on GitHub, compiles with GCC7/Clang4, integrates with Boost.Hana/fit examples, is used in VM core and ecsst prototypes, and assembly comparisons show no measurable runtime cost — it works.
AI-written summary · about
chapters (10)
- 0:00Start
- 0:11Talk overview
- 0:46What is "static" control flow?
- 1:22Example: static if in D
- 2:39Example: handling variadic argument packs (traditional)
- 3:23Example: handling variadic argument packs (static if)
- 5:23History of static if proposals - 1
- 12:29C++14 static if -instantiating matching branch
- 13:28find matching branch
- 13:47instantiate and call matching branch
related talks
01h 03m“Implementing `static` control flow in C++14"
01h 00mconstexpr: Applications
32mCute C++ Tricks, Part 2 of N: More code you should learn from and never write
59mModern C++ for Fun and Profit: This isn’t your old C++
01h 04mconstexpr: Introduction
57mIntroduction to C++ Template Metaprogramming
01h 04mC++ Lambda Idioms
51mModern techniques for keeping your code dry
