Overview
Explore pattern matching in C++ through this comprehensive conference talk from C++Now 2019. Dive into Michael Park's presentation on a proposal to add pattern matching as a language feature in C++. Learn why pattern matching is increasingly relevant to C++ and how it can simplify code structure. Examine numerous examples demonstrating the power of this declarative approach for structured inspection of complex data types. Gain insights into the concrete features being proposed, including primary patterns, expression patterns, structured bindings, and extractor patterns. Understand the potential impact of pattern matching on C++ development and participate in the early stages of this proposal by providing feedback. Compare C++'s approach to pattern matching with implementations in other languages like Haskell, OCaml, Rust, Scala, and Swift.
Syllabus
Introduction
Switch
Dynamic Cast
Structural Association
Least Power
Selection Power
StateVisit
Decomposition
Decomposition Example
Motivation
Pattern Matching
Summary
Example
Patterns vs Values
Statement Form
Expression Form
End of Expression
Declaration Form
Disclaimer
Primary Patterns
Expression Patterns
Parenthesized
Structured Bindings
Designated Initializers
Variants
Any
Polymorphic
Binding Pattern
Can this be an expression
Star Pattern
Extractor Pattern
Extraction Pattern
Extraction Example
structre
Taught by
CppNow