Template Metaprogramming: Type Traits (part 2 of 2)
summary
Continues implementing standard type traits from first half by showing concrete code: counts like 14 primary type categories, examples needing up to 12 or 64 specializations motivate abstractions such as remove_cv composition and alias-template meta‑functions; builds is_same, is_floating_point, is_integral, is_array, is_pointer and shows reducing dozens of specializations to a few composed meta‑functions; demonstrates overload resolution, decltype/declval in unevaluated contexts, and SFINAE (substitution failure is not an error) to detect classes versus other categories; notes some traits require compiler intrinsics.
AI-written summary · about
chapters (16)
- 0:00Start
- 0:36Primary type categories is_class
- 3:21is_null_pointer
- 6:33Metafunction Abstractions
- 8:10Code Review
- 8:51A Step In The Right Direction
- 10:42remove_volatile
- 14:00remove_cv
- 22:15is_floating_point: redux
- 23:16is_integral: redux
- 26:50is_array
- 31:59is_pointer
- 33:44is_union
- 36:40is_class_or_union
- 39:44Function Overload Resolution
- 44:02SFINAE
related talks
01h 07mBack to Basics: Templates (part 2 of 2)
59mModern Template Metaprogramming: A Compendium, Part II
01h 01mThe promise of static reflection in C++26: Type Traits without compiler intrinsics
41mTemplate meta-programming: Why you must get it
22mTraits and You: A Deep Dive
49mA new look at TMP
53mFrom C++ Templates to C++ Concepts - Metaprogramming: an Amazing Journey
01h 37mExtending and Simplifying C++: Thoughts on Pattern Matching using `is` and `as`
