Functional C++ For Fun And Profit

By Phil Nash

C++11 gave us lambdas in the language for the first time (if you ignore boost::lambda) - so it’s a functional language now, right? There’s a bit more to functional programming than having first class function objects. I’d even argue we still don’t quite have that. But does that mean we can’t do functional programming in C++? Yes. No. Maybe…​

First we have to define what functional programming actually is - and it may not be quite what you think. Then we need to see what valuable ideas have come out of the functional approach to software design and which ones we can use in C++ to good effect.

In the end we’ll see that, while not strictly a functional programming language, we can get quite a long way with immutable data types, persistent data structures, atomic references, and - if you’re not watching carefully - we might even throw the M word in there!





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.