Template Metaprogramming: Type Traits (part 1 of 2)
summary
Walks through implementing many std type traits from first principles, showing actual code patterns: integral_constant and true_type/false_type as value-and-type returns, alias helpers like underscore_t/_v for calling conventions, and remove_const via partial specialization. Explains when compiler intrinsics are required, why specializing standard templates or using incomplete types causes undefined behavior, and how C++17 auto non-type params and C++20 concepts change implementations. Examples compile and expose the precise rule that makes each trait correct.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:21Intended Audience
- 8:18Tutorial Format
- 16:14Value Metafunctions: Sum
- 19:09Calling Type Metafunctions
- 21:17Convenience Calling Conventions
- 28:37Cpp17UnaryType Trait
- 30:18Cpp17Transformation Trait
- 31:14Undefined Behavior
- 33:51is_void (Unary Type Trait)
- 44:58remove_const(Transformation Trait)
- 53:46conditional
related talks
59mModern Template Metaprogramming: A Compendium, Part II
01h 01mThe promise of static reflection in C++26: Type Traits without compiler intrinsics
01h 07mBack to Basics: Templates (part 2 of 2)
53mFrom C++ Templates to C++ Concepts - Metaprogramming: an Amazing Journey
22mTraits and You: A Deep Dive
41mTemplate meta-programming: Why you must get it
01h 02mBack to Basics: Templates in C++
59mBack to Basics: Generic Programming in C++
