C++20 Concepts
summary
Demonstrates using C++20 Concepts to replace a 19-class, inheritance-heavy libc++ implementation of libc++ optional with a single class, cutting 1187 lines to 1068 and eliminating repeated equals-default/delete boilerplate; destructor, copy and move logic use trailing requires to select implementations instead of base-class specialization. Tests pass libc++ optional test suite, and a simple compile benchmark shows ~463 ms → ~391 ms (≈72 ms) faster compilation with the concept-based version; clang lacked a needed feature so g++ was used.
AI-written summary · about
chapters (22)
- 0:00Intro
- 1:50Concepts
- 3:45Applications
- 7:25Requirements
- 10:07Concepts in other places
- 12:00Function templates
- 14:20Rethink the past
- 14:57Inheritance for everything
- 20:02Java Interface
- 21:13C Interface
- 27:31Implements
- 35:16Inheritance
- 36:12Dependent Constructor
- 37:13Destructor
- 38:13Updating STL
- 40:30Optional Destructor
- 42:28Optional Storage
- 49:43Optional Template
- 50:40Diagram
- 52:41Constructor
- 53:59Copy
- 56:43Summary
related talks
01h 02mC++20 - My Favourite Code Examples
01h 28mC++ Concepts "Lite" in Practice
01h 27mC++20 Templates - the Next Level: Concepts and More
01h 07mC++20 Concepts: A Day in the Life
59mThe Best Parts of C++
52mConcepts: The Future of Generic Programming
04mConcepts in 5
55mHow to Implement Your First Compiler Feature:The Story of Concepts in Clang
