“Variable Templates and Compile-Time Computation with C++14"
summary
C++14 variable templates plus relaxed constexpr let the compiler build real constants: this uses variable templates and integer_sequence to emit a 20×20 multiplication table as a compile-time string, verified with static_assert, and to generate a compile-time sine lookup via a crude Taylor series into a variable template. code uses a tiny std::array replacement to return arrays from constexpr functions, relies on return type deduction, and works but easily exceeds compiler evaluation limits (default ~1,000,000 steps) and causes long compile times.
AI-written summary · about
chapters (21)
- 0:00Intro
- 2:31C++03 Compile-time Computation
- 3:52C++11 Feature: constexpr variables and static assert()
- 5:53C++11 Compile-time Computation
- 9:35Reminder: functions, templates, patterns
- 11:14C++11 standard mistake: literal types
- 12:12User-defined Literals vs Literal Types
- 14:05Variable Templates
- 18:47C++14 constexpr function rules
- 20:01C++14 Compile-time Computation
- 23:38Literal Types and constexpr
- 27:17Limitation: Parameters
- 29:13integer_sequence/index_sequence
- 32:55compile-time sequence handling
- 37:59Converting numbers to CTS
- 41:48Computing with integer_sequence
- 44:55character_sequence from a row
- 49:16putting table together...
- 51:53A table with sine values for a circle
- 53:19constructing the table
- 54:58using degrees for constants
related talks
01h 03mOLD VERSION: Understanding The constexpr 2-Step
01h 03mUnderstanding The constexpr 2-Step
01h 01mRethinking the Way We Do Templates in C++
01h 04m“Constant Fun"
01h 09m“Compile-time programming and reflection in C++20 and beyond”
01h 01m“How bad is Meta-Programming still today?"
01h 10m“constexpr ALL the Things!”
01h 30mRethinking the Way We Do Templates in C++
