REVIEW - C++ Lambda Story - Everything You Need to Know about Lambda Expressions in Modern C++!


C++ Lambda Story

Everything You Need to Know about Lambda Expressions in Modern C++!


Bartłomiej Filipek


Leanpub (2021)




Roger Orr


January 2024



Verdict: Highly Recommended

Lambda expressions are one of the most used features of C++. A lambda expression, commonly abbreviated to just a “lambda”, is a (possibly anonymous) function object that can be defined close to where it is invoked or passed as a function argument. While the basic concept is simple, to use them to best effect you need to understand more of the details. I found this book was a well constructed guide to understanding lambdas in C++20.

The book is structured as a historical progression from the original C++ standard (which had no lambda support) up to C++20, split up with one chapter for each version of the C++ standard. You don’t have to read it sequentially though, and the “How to Read This Book” section gives a couple of suggestions for possible readers.

I think that this chronological basis for the book works well, as the changes made in the various versions of C++ since their introduction mostly build upon the capabilities of the previous standard. The book does a good job of explaining what each new version of the language offered to users of lambdas, and gives motivation for the changes that were made.

There are numerous examples throughout the book, and in some cases later examples build on earlier ones to make use of better ways to achieve similar results, or contrast different approaches to the same problem. This can be useful for those who are not able to adopt the latest C++ standard into their current project, for whatever reason.

If you are a relative novice when it comes to using lambdas I think that book will give you a gentle, but directed, introduction to using the power of lambdas but I think even experienced users of lambdas would learn something.

One minor restriction of the print version of the book is that the links to live code, hosted in Wandbox, are not available. However, the link to github repo can be used to find the examples and it’s simple enough to copy and paste them into the online (or offline) compiler of your choice.

I don’t know if Bartłomiej plans to update the book to cover C++23 when it becomes officially published, but I hope he does so.


Your Privacy

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

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.