Concepts in 60: Everything you need to know and nothing you don't
summary
Concepts arrive as a way to constrain templates so the compiler checks syntactic requirements at use and prevents bizarre instantiations; the Concepts TS is implemented in GCC since 6 and has a Clang port, and -std=c++2a or -fconcepts-ts enable the features. Examples show min_element requiring a ForwardIterator and a requires clause that the iterator value be TotallyOrdered, explain NaN and preconditions, describe overload subsumption via a small compiler theorem prover, and recommend starting from concrete examples and erring on stronger constraints.
AI-written summary · about
chapters (20)
- 0:00Introduction
- 3:03GCC
- 4:10Generic Libraries
- 6:03Algorithms
- 9:25Generic Programming
- 12:03Templates
- 14:51Concepts
- 16:53Where do concepts come from
- 17:52Can a type be a type
- 19:28Types concepts and values
- 21:12Whats a constraint
- 21:44Whats a concept
- 24:17Generic Algorithm
- 28:06Constraint
- 29:18Preconditions
- 33:10Syntax operations
- 35:58Over constraining
- 43:19Specialization
- 45:59Subsumption
- 53:57Questions
related talks
04mConcepts in 5
01h 28mC++ Concepts "Lite" in Practice
54mC++ Concepts for Developers
52mConcepts: The Future of Generic Programming
59mMetaprogramming: From Templates to Concepts
06mConstraints not Satisfied
55mHow to Implement Your First Compiler Feature:The Story of Concepts in Clang
01h 27mC++20 Templates - the Next Level: Concepts and More
