“Programming with C++ Constraints: Background, Utility, and Gotchas"
summary
Claims that C++ will adopt compile-time constraints via requires-clauses and that they integrate with existing tools like enable_if and constexpr if. Demonstrates by reimplementing std::swap two ways and running vendor test suites: the enable_if version passes but the requires version triggers a single unexpected failing is_swappable test. Root cause is subsumption changing overload partial ordering, so the requires-based implementation compiles differently — a small, detectable semantic difference.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 1:56The Bigger Picture
- 4:07Precondition
- 11:08Newer technologies
- 14:16Premodern constraints
- 17:41Specialization constraints
- 19:56Template declaration
- 24:31Enable if
- 26:39Limitations of Enable if
- 28:00Modern postmodern constraints
- 30:27Concepts
- 32:25Technical Details
- 37:44Programming withConstraints
- 41:45Case Study
- 47:38Enable Lift
- 49:27Swappable
- 52:47Requires
- 54:13Quick caveat
- 55:01C Core Language Constraints
related talks
58mExploration of C++20 Meta Programming
01h 07mConcepts As She Is Spoke
54mC++ Concepts for Developers
01h 39m“Concepts: The Future of Generic Programming (the future is here)”
01h 11mConcepts in 60: Everything you need to know and nothing you don't
13mFast Constraint Synthesis for C++ Function Templates
01h 21mProgramming with Contracts in C++20
01h 05mAdvancing cppfront with Modern C++: Refining the Implementation of is, as, and UFCS
