Skip to main content

Posts

Showing posts from September, 2017

New Tools for a More Functional C++

I presented the following slide deck at the ACCU meetup yesterday. New Tools for a More Functional C++ from Sumant Tambe Abstract: Variants have been around in C++ for a long time and C++17 now has std::variant. We will compare inheritance and std::variant for their ability to model sum-types (a fancy name for tagged unions). We will visit std::visit and discuss how it helps us model the pattern matching idiom. Immutability is one of the core pillars of Functional Programming (FP). C++ now allows you to model deep immutability; we'll see a way to do that using the standard library. We'll explore if `return std::move(*this)` makes any sense in C++. Immutability may be a reason for that.