C++ Lambda Story
Last updated on 2020-04-30
About the Book
This book shows the story of lambda expressions. We'll start with C++03 and a motivation to have "ad-hoc" functors, and then we'll move into the latest C++ standards:
- C++11 - early days of the feature. You'll learn about all the essential aspects of lambdas and several tricks you might apply. This is the longest chapter as we need to cover a lot of topics.
- C++14 - updates. See how to use generic lambdas and captures with an initialiser.
- C++17 - more improvements, especially by handling `this` pointer and allowing `constexpr`. You'll also learn about the overloaded pattern and how to derive from lambda.
- C++20 - in this section you'll see all of the new features adopted for C++20 like template lambdas and how to use them with concepts and constexpr algorithms.
The book is based on two articles that appeared at bfilipek.com:
The articles also are inspired by a live coding presentation given by C++ Expert Tomasz Kamiński at our local Cracow C++ User Group.
The book contains updated code examples, new sections and better in-depth descriptions. All the new additions make it twice the size of the initial material that is available on the blog!
Below, you can find the GoodReads page for the book with the readers' feedback:
About the Book
- Roots Of The Book
- Who This Book is For
- Reader Feedback
- About the Author
- Revision History
1. Lambdas in C++03
- Callable Objects in C++03
- Motivation for a New Feature
2. Lambdas in C++11
- The Syntax
- The Type of a Lambda
- The Call Operator
- Return Type
- Conversion to a Function Pointer
- IIFE - Immediately Invoked Function Expression
- Inheriting from a Lambda
3. Lambdas in C++14
- Default Parameters for Lambdas
- Return Type
- Captures With an Initializer
- Capturing a Member Variable
- Generic Lambdas
- Bonus - LIFTing with lambdas
4. Lambdas in C++17
- Updates To IIFE
- Deriving from Multiple Lambdas
5. Lambdas in C++20
- A Quick Overview of the Changes
- Template Lambdas
- Concepts and Lambdas
- Changes to Stateless Lambdas
- C++20 Updates to the Overloaded Pattern
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.