Compile-Time Compression and Resource Generation with C++20
summary
C++20 constexpr/consteval/constinit plus lambdas-as-types generate real artifacts: a 32-entry lerp sine lookup table built at compile time, Huffman-compressed string maps with a packed bitstream and encoded tree that return iterators instead of full strings, and flash-placed configuration registers (example placed at 0x100 via linker script) for MCU fuses. Implementation is header-only, uses a GCC constexpr math extension, hits compiler resource/constexpr limits so it caches character‑to‑bit mappings, and otherwise works end‑to‑end.
AI-written summary · about
chapters (23)
- 0:00Intro
- 1:54constexpert
- 2:40context with variables
- 3:48context with functions
- 5:08consteval init
- 6:09Overview
- 7:10Why
- 13:40Conflict Users
- 15:09Vendor Specific Extensions
- 19:56Linking
- 24:25Where to next
- 25:32Return size and type
- 26:42Lambdas
- 33:15String Table
- 36:28Huffman Code
- 38:31Library Process
- 43:51Modularization
- 48:03Containers
- 48:26Constant Expert
- 48:59Heap Allocation
- 49:38Debugging
- 51:17Configuration Descriptor
- 53:18Length Methods
related talks
01h 05mFast and small C++ - When efficiency matters
01h 03mFast and Small C++ - When Efficiency Matters
37mC++ as an Optimizing Assembler - a Performance Talk
54mFast C++ by using SIMD Types with Generic Lambdas and Filters
56m“High Performance Code 201: Hybrid Data Structures"
01h 04mC++20’s [[likely]] Attribute - Optimizations, Pessimizations, and [[unlikely]] Consequences
01h 04mCompile-time sparse matrices
47mRethinking compilers with live coding
