CppCon 2015 has ended
Back To Schedule
Tuesday, September 22 • 2:00pm - 3:00pm
Simple, Extensible Pattern Matching with C++14

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Recently, there has been in increased interest in applying functional programming techniques to C++. A very convenient construct that is used in functional programming languages is pattern matching. Due to the features introduced in C++11 and C++14 we can actually write a simple, easy to use, understandable, and extensible pattern matching library that is header only and uses no macros.

In this talks we will discuss the motivations for pattern matching, and see examples of use from other languages. We will then go on to design and implement a pattern matching library in C++. Particular attention will be payed to new C++14 features that greatly simplify the implementation such as integer_sequence, function return type deduction, and generic lambdas. The implementation will also serve a practical guide to using variadic templates and std::tuple.

We will show how the library can be easily extended and customized by working through some examples of customization such as working with user defined classes and structs, pointers, tuples, boost::optional, and boost::variant. At the end of the session, the audience will have an appreciation for pattern matching, as well as a sense that the C++11/14 features open new paradigms without sacrificing understandable code.

avatar for John Bandela

John Bandela

Software Engineer, Google
I first started programming in C++ at age 14 in 1994 when I cajoled my parents into buying me Visual C++ 1.0 for my birthday. It took a while, but as I learned the language, I decided I really liked C++. I attended the University of Florida and obtained my undergraduate degree in... Read More →

Tuesday September 22, 2015 2:00pm - 3:00pm PDT
Six (406) Meydenbauer Center

Attendees (0)