First, in this chapter, we tried to modify a local variable in a functional way. We cannot reuse the variable we created; instead, we have to create another one when we need to modify it. We also discussed the technique to modify the variable we passed to another function. Instead of passing the argument by value, we have to pass it by reference to make it change.

Then, we dug the use of the const keyword to provide the immutable behavior to the function. By using this keyword, we can ensure that the variable inside the class cannot be modified. Another discussion was about applying the first-class and pure functions--things you learned in the previous chapter--to gain the power of immutability.

We also created the mutable class and ...

Get Learning C++ Functional Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.