So far, we've explored several ways of writing code in a functional style in C++. Now, we'll take a look at some additional options that are allowed by the C++ 17 standard, and at a few options that are enabled by C++ 20. So, let's start by writing pure functions.
Standard language support and proposals
Pure functions
Pure functions are functions that return the same outputs when receiving the same inputs. Their predictability makes them useful for understanding how the written code correlates with its runtime performance.
We discovered in Chapter 2, Understanding Pure Functions, that writing pure functions in C++ requires a combination of const and static, depending on whether the function is part of a class...