This repository contains runnable code examples from the book Functional Programming in C++.
The examples are separated into different directories based on the chapter of the book they belong to.
chapter-01
- Introduction to functional programmingchapter-02
- Getting started with functional programmingchapter-03
- Functional objectschapter-04
- Creating new functions from the old ones
The common
directory contains files that are used in multiple different examples like the person_t
type defined in the <person.h>
header file.
The 3rd-party
directory contains free/libre open source 3rd party libraries used in the examples.
Most examples are contained in a single .cpp
file that can be easily executed in any IDE. For people who prefer working in a terminal, or an editor like Vim or Emacs, an example Makefile compatible with the GNU Make command has been provided that can be used to compile the example. The Makefile uses GCC
as the compiler, but this can be changed by altering the value of the CXX
variable.
Most of these examples use C++14
and C++17
, so you will need a modern compiler in order to compile them. The latest stable versions of GCC or Clang are recommended.