Fun? with NTTPs in C++
summary
Shows how to make non‑structural objects usable as NTTPs by wrapping in a lambda so the value can be extracted via constexpr calls, and demonstrates a small CX_VALUE macro that exposes a concept so functions need not be constexpr. Explores grammar oddities that let qualifiers and attributes slip into template parameters (tested on GCC/Clang), including using volatile template parameter and alignas on NTTP, and points out compiler divergences and surprising acceptances.
AI-written summary · about
chapters (10)
- 0:00Intro
- 0:16Private members
- 0:29Lambda
- 0:50Conexp
- 1:33Grammar
- 2:08Template Parameters
- 2:22Volatile Template
- 2:38Useful Attributes
- 2:56Virtual
- 3:22AIGN
related talks
01h 01mRethinking the Way We Do Templates in C++
54mData in the Type System: Complex Non-Type Template Parameters in C++20
57mIntroduction to C++ Template Metaprogramming
01h 00mRemoving Metaprogramming From C++, Part 1 of N: constexpr Function Params
01h 27mC++20 Templates - the Next Level: Concepts and More
01h 30mRethinking the Way We Do Templates in C++
01h 39m“Thoughts on a more powerful and simpler C++ (5 of N)”
01h 00mModern Template Metaprogramming: A Compendium, Part I
