C++ Concepts
summary
C++20 Concepts let generic code state actual constraints so overload resolution and diagnostics improve: use requires clause and named concepts to pick push_back versus insert, constrain auto and class members, and subsume specializations (random_access_range wins over input_range). Testing is compile-time via static_assert tests and compile-time if branches. Standard helpers like std::ranges::range and remove_cvref appear; examples include a prime-size non-type template that fails to compile and clearer clang/GCC constraint diagnostics, while runtime semantics remain only documented.
AI-written summary · about
chapters (7)
- 0:00C++20 Concepts intro
- 7:30Generic insertion with Concepts
- 21:00Testing Concept definitions
- 30:34Requires clauses
- 38:24Concept hierarchies
- 51:39Where Concepts apply
- 1:00:42Q&A
related talks
01h 01mBack to Basics: Concepts in C++
58mGeneric Programming with Concepts Lite, Part I
01h 11mC++20 Templates: The next level: Concepts and more
01h 05mGeneric Programming with Concepts Lite, Part II
05mLightning Talks: -std=c++20 -- Will This C++ Code Compile?
06mLightning Talk: C++20 - A New Way of Meta-Programming?
01h 01mConcepts vs Typeclasses vs Traits vs Protocols
01h 02mDiscovering a User-Facing Concept
