“Constant Fun"
summary
Shows how to build a compile-time associative container (string-to-enum/factory) using C++11 templates and C++14 constexpr features like string_view and index_sequence, and implements compile-time merge/quick sort and merge routines to produce a sorted, duplicate-free map. Demonstrates that template-recursive implementations blow up compile time while a constexpr sort shrinks compile times from tens of seconds to a few seconds, and shows static_assert tests that run at compile time with zero runtime cost.
AI-written summary · about
chapters (22)
- 0:00Intro
- 0:45Overview
- 1:56Constant Expressions
- 6:05Bitmask vs. constexpr
- 8:07constexpr Functions
- 10:40Literal Types
- 12:57Names in constexpr
- 14:00Name Example
- 17:16Name Implication
- 18:21Objective
- 19:25Attempt: Use an Array
- 20:13Detour: string_view
- 28:25Validity of constexpr Fun
- 30:37constexpr Map Members
- 30:57Deducing Type
- 33:19Sorting Elements
- 41:51Constexpr Factory Map
- 42:24Times gcc
- 44:14Compile-Time Test
- 46:08C++17 constexpr
- 49:12Conclusions
- 52:07Times clang
related talks
01h 03mOLD VERSION: Understanding The constexpr 2-Step
01h 00mconstexpr: Applications
01h 18m“Variable Templates and Compile-Time Computation with C++14"
01h 04mconstexpr: Introduction
01h 10m“constexpr ALL the Things!”
01h 03mUnderstanding The constexpr 2-Step
25m“A Semi Compile/Run-time Map with (Nearly) Zero Overhead Lookup”
57mIntroduction to C++ Template Metaprogramming
