CppCon 2017: Michael Park “MPark.Patterns: Pattern Matching in C++” HD
http://CppCon.org — Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/CppCon/CppCon2017 — Pattern matching brings a declarative approach to destructuring and inspecting complex data types. It’s a very powerful abstraction provided by many programming languages such as Haskell and OCaml, and more recently, Rust, Scala, and Swift. We’ll see a glimpse of pattern matching in C++17 and their current limitations through features such as structured bindings, `apply`, and `visit`. We’ll then jump into MPark.Patterns, an experimental pattern matching library for C++. The following is an example of `fizzbuzz` written with the library: void fizzbuzz() { for (int i = 1; i <= 100; ++i) { using namespace mpark::patterns; match(i % 3, i % 5)( pattern(0, 0) =