Pattern Matching in C++14
summary
A C++14 library implements algebraic-style pattern matching with a match(expr) API that binds variables, supports value, wildcard, alternation and prod pattern for tuples and adapted structs, and includes a pattern guard for predicates. Examples include factorial, fizzbuzz (using pair of mods), Fibonacci with bind and guards, and a working red‑black tree balance rewrite using structured-binding adapters. The library reproduces Haskell/Rust patterns in single-source C++14 and expresses a nested alternation that Rust cannot.
AI-written summary · about
chapters (6)
- 0:00Start
- 0:40Pattern Matching on Simple Values
- 1:16Command Line Flags
- 2:21Syntax
- 3:15Factorial
- 4:03Fibonacci Example
related talks
01h 03mPattern Matching: A Sneak Peek
58mThe Pattern Matching We Already Have
39mAre You Structure Bindable? A Tour via Concepts, SFINAE & Herb Sutter's Pattern Matching
01h 34mMetaprogramming in C++14
01h 07mDesign Patterns in Modern C++
01h 08mC++ Metaprogramming: A Paradigm Shift
01h 03mHigher order functions for ordinary C++ developers
58mC++ Error Handling Revisited
