Back to Basics: Templates (part 2 of 2)
summary
Covers concrete rules and worked examples: implements a template min (with return-type deduction), builds a stack adapter plus a pointer-specialized partial specialization that changes pop semantics, and implements trait utilities like is_pointer and remove_cv/remove_ref to normalize element types. Explains why reference collapsing and forwarding reference rules enable perfect forwarding, shows two-phase name lookup and instantiation behavior (implicit vs explicit), and demonstrates that the examples compile and behave as claimed.
AI-written summary · about
chapters (31)
- 0:00Introduction
- 1:18Recap
- 3:11Translation Units
- 4:13Declarations Definitions
- 6:46Multiple Definitions
- 10:22Template to Specialization
- 13:16Two Phase Translation
- 15:50Complete Incomplete Types
- 17:40Recipe Visibility
- 18:21Example
- 20:58Value Categories
- 29:49Function Templates
- 36:00Simple Template Parameters
- 36:33Type Inference
- 37:22Syntax Forms
- 40:04Reference Collapse
- 44:11Forwarding Reference
- 47:53Informal Steps
- 50:04Class Templates
- 50:32Template Parameter
- 50:58Template Parameter Scope
- 52:11Class Scope
- 52:21InsertMember
- 52:41Stack Angle Bracket
- 53:42Const Iterator
- 54:12Reverse Iterator
- 54:49Cont Iterator
- 57:08Static Data Members
- 57:47Static Variables
- 58:13Full Specialization
- 59:43Partial Specialization
related talks
01h 02mBack to Basics: Templates in C++
54mModern Template Techniques
59mBack to Basics: Generic Programming in C++
59mTemplate Metaprogramming: Type Traits (part 2 of 2)
01h 00mTemplate Metaprogramming: Type Traits (part 1 of 2)
59mModern Template Metaprogramming: A Compendium, Part II
41mTemplate meta-programming: Why you must get it
57mAlices adventures in Template Land
