~/talk

What Has C++20 Ever Done For Templates?

Talkat ACCU 2022 · 2022-04-06..04-09· [c-and-cpp, compilers-and-language-design]
slides:none on file

C++20 actually adds concrete template tools: concepts provide compiler-enforced predicates (std::invocable, std::same_as, predicate hierarchy) and drive overload resolution via named-concept subsumption; non-type template parameters now accept floats as NTTPs and “structural” literal-class values (and lambdas without captures), with gotchas: floating-point bit-equality matters and private members or non-constexpr destructors forbid structural NTTPs; templated and constrained lambdas let parameters share template types and use constraints directly; examples show compile-time string keys for strong types and ratio types for units, and the new features work but require attention to representation and visibility rules.

AI-written summary · about

  1. 0:00Start
  2. 2:10Feedback and Questions
  3. 3:18More Resources
  4. 4:05What Has C-20 Ever Done for Templates?
  5. 5:29Use Case
  6. 7:53What Is a Concept?
  7. 8:41Concepts From the Standard Library
  8. 11:20Error Messages and Templates With Constraints
  9. 12:29Requires Clause
  10. 13:58Even More Constraints
  11. 17:01Pitfalls
  12. 22:35Type Requirements
  13. 23:33Compound Requirements
  14. 25:23Nested Requirements
  15. 26:00Floating PointContainer Concepts
  16. 29:26A Function Which Takes Another Callable
  17. 31:10std::function for Constraining
  18. 32:06Implementation With Standard Concepts
  19. 38:36Examples for Subsumption
  20. 47:13Overload Resolution With Standard Concepts
  21. 50:50Summary
  22. 53:19Examples For Structural Types
  23. 56:02Floats and Doubles as NTTP
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.