Concepts As She Is Spoke
summary
Clear-eyed tour of C++2a Concepts syntax and semantics, with concrete compiler status (GCC supports the Concepts TS via -fconcepts, Clang has a fork, MSVC largely ignores concepts), side-by-side Godbolt demos, and practical rewrites from enable_if to requires clauses. Covers risky, testable issues: requires clauses don't mangle names (ODR/linker trouble for constrained vs unconstrained templates), the difference between requires expressions vs requires clauses, terse-parameter syntax and common gotchas (missing braces, sizeof misunderstandings), plus how ranges TS and normal-form/subsumption rules affect overload resolution.
AI-written summary · about
chapters (25)
- 0:00Intro
- 1:54Outline
- 2:47What's the state of Concepts?
- 5:16What is a concept, anyway?
- 8:37Defining a concept (old-school)
- 12:24requires clauses aren't template parameters
- 15:16Duplicate function templates are OK
- 15:34Different story with class templates
- 16:35Remember this old-school trap?
- 20:09Two distinct "better match" criteria
- 24:38Constraints are logical formulas!
- 25:19Normalization and normal form
- 26:22Logical operations are commutative
- 26:50Non-atomic concepts
- 34:35Noexcept-expression vs. clause
- 36:46Kinds of requirements
- 38:25GCC (not C++2a) supports auto
- 38:57Fun traps for the unwary
- 40:17Minor traps for the unwary
- 45:38Perfect forwarding?
- 48:15Terse syntax(es)
- 50:58Non-type concepts
- 51:21Metaprogramming with concepts
- 51:45Multi-parameter concepts
- 55:05Constrained non-template functions?
related talks
54mC++ Concepts for Developers
01h 28mC++ Concepts "Lite" in Practice
55mHow to Implement Your First Compiler Feature:The Story of Concepts in Clang
52mConcepts: The Future of Generic Programming
01h 27mC++20 Templates - the Next Level: Concepts and More
59mMetaprogramming: From Templates to Concepts
01h 00mConcepts in C++20: Revolution or Evolution
01h 07mC++20 Concepts: A Day in the Life
