Rethinking the Way We Do Templates in C++ even more
summary
Implementation of a Physical Units Library uses downcast via hidden friend ADL+CRTP to replace long aliased template instantiations so debugging and compile-time errors show friendly unit names instead of giant types; adopting class-types-as-NTTPs and concepts moves ratio arithmetic from deep template recursion to value-like operations. Metabench (gcc/clang comparisons) shows variable-template specializations and NTTP-based ratios compile several× faster, with some compile steps falling from tens of seconds to a few, and the approach works in practice.
AI-written summary · about
chapters (22)
- 0:00Start
- 3:34Physical Units library in a nutshell
- 5:36Toy example
- 11:00User's experience: Compilation: NHolthaus Units
- 13:26A need to modernize our toolbox
- 14:45User's experience: Debugging: Boost.Units
- 16:44Type aliases are great for developers but not for end users
- 20:32Type substitution problem
- 21:52Downcasting facility (Version 1.0)
- 23:44Downcasting facility (Version 2.0): Overview
- 26:01Downcasting facility: Design
- 29:13User experience: Debugging
- 36:27Non-type template parameters (NTTP) (C++20)
- 37:30NTTP:Template argument equivalent values (C++20)
- 43:06Class Types in Non-Type Template Parameters
- 43:58How do you feel about such an interface?
- 46:39Concept categories
- 49:33New concept category?
- 51:20Concepts perception issue
- 55:02Concepts example
- 57:48What is the difference?
- 59:44Benefits of using C++ Concepts
related talks
01h 30mRethinking the Way We Do Templates in C++
01h 23mThe Power of C++ Templates With mp-units: Lessons Learned & a New Library Design
47mReducing Template Compilation Overhead, Using C++11, 14, 17, and 20.
01h 31mImplementing Physical Units Library for C++
01h 00mModern Template Metaprogramming: A Compendium, Part I
57mIntroduction to C++ Template Metaprogramming
01h 21mWhat Has C++20 Ever Done For Templates?
01h 10mThe C++ Type System Is Your Friend
