~/talk

Pattern Matching: A Sneak Peek

Talkat CppCon 2019 · 2019-09-15..09-20· [c-and-cpp]
links:none on file
slides:none on file

Proposal P1371 r1 brings pattern matching to C++ as a statement and expression form and shows concrete syntax and semantics: P1371 r1 documents inspect blocks, inspect expression with optional trailing return type, let vs case modes to disambiguate identifiers, wildcard and structured-binding patterns, designated-field patterns, alternative patterns for variants, reference patterns (!, ?) and a user-defined extractor pattern demonstrated with CTRE regex extraction. Examples show how nested std::variant + structured bindings collapse into compact matches and how this can eliminate repetitive dynamic_cast/std::visit boilerplate; the work is a draft proposal, not yet a language change.

AI-written summary · about

  1. 0:00Introduction
  2. 1:42Motivations
  3. 8:47Composition
  4. 12:18What is Pattern Matching
  5. 12:53Point Example
  6. 13:36Color Coding
  7. 14:01Declarative
  8. 14:13A Closer Look
  9. 15:09Pattern Matching
  10. 17:30Patterns and Values
  11. 18:55Structure
  12. 20:05Expression Form
  13. 20:58Multiple Returns
  14. 21:48Pattern Guard
  15. 24:05Disclaimer
  16. 24:31Wildcard Pattern
  17. 25:27Identifier Pattern
  18. 26:01Wildcard
  19. 26:47Expression Pattern
  20. 27:43Static Concepts
  21. 28:01Two Modes
  22. 29:07Existing declarations
  23. 31:12Repeating the P
  24. 32:25Nesting into patterns
  25. 33:12Richards comment
  26. 33:28Structured bindings
  27. 35:02Alternative Pattern
  28. 36:06Constant Expression
  29. 36:32Auto
  30. 36:50Integral Concept
  31. 37:34Polymorphic Types
  32. 38:40Reference Pattern
  33. 41:25Star Questionmark
  34. 42:48Extractor
  35. 44:30CompilerTime Regular Expressions
  36. 44:49GTRe
  37. 46:17QuestionMark
  38. 47:05Extractors
  39. 48:24Syntax
  40. 50:18Visit
  41. 50:53Is Pattern Matching Required
  42. 52:30Double Underscore
  43. 54:13Expressions vs Statements
  44. 56:25wildcard patterns
  45. 57:11pattern matching in C
  46. 58:31best match vs first match
~/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.