O'Reilly logo

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design by Dmitri Nesteruk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A: Functional Design Patterns

While C++ is primarily an object-oriented programming language, the support of functional objects (e.g., std::function) together with lambda functions gives it limited support for monads, which are design patterns of the functional programming world. It has to be said, though, that monads are much more usable in functional programing languages thanks to better treatment of functional objects as well as useful auxiliary constructs (e.g., algebraic data types, pattern matching, etc.).

It is not my intention to show a catalogue of monads in this book, but I do want to show at least one example of a monad that can be used by C++ developers.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required