C++ Lambda Story
C++ Lambda Story
Minimum price
Suggested price
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:

C++ Lambda Story @GoodReads

About the Author

Bartłomiej Filipek
Bartłomiej Filipek

Bartłomiej (Bartek) Filipek is a C++ software developer with more than 12 years of professional experience. In 2010 he graduated from Jagiellonian University in Cracow, Poland with a Masters Degree in Computer Science.

Bartek currently works at Xara, where he develops features for advanced document editors. He also has experience with desktop graphics applications, game development, large-scale systems for aviation, writing graphics drivers and even biofeedback. In the past, Bartek has also taught programming (mostly game and graphics programming courses) at local universities in Cracow.

Since 2011 Bartek has been regularly blogging at bfilipek.com. Initially, the topics revolved around graphics programming, but now the blog focuses on core C++. He's also a co-organiser of the C++ User Group in Cracow. You can hear Bartek in one @CppCast episode where he talks about C++17, blogging and text processing.

Since October 2018, Bartek has been a C++ Expert for the Polish National Body which works directly with ISO/IEC JTC 1/SC 22 (C++ Standardisation Committee).

In the same month, Bartek was awarded his first MVP title for the years 2019/2020 by Microsoft.

In his spare time, he loves collecting and assembling Lego models with his little son.

Bundles that include this book

C++17 in Detail
C++ Lambda Story
Suggested Price
Bundle Price

Table of Contents

  • About the Book
    • Roots Of The Book
    • Who This Book is For
    • Reader Feedback
  • About the Author
  • Acknowledgement
  • Revision History
  • 1. Lambdas in C++03
    • Callable Objects in C++03
    • Issues
    • Motivation for a New Feature
  • 2. Lambdas in C++11
    • The Syntax
    • The Type of a Lambda
    • The Call Operator
    • Captures
    • Return Type
    • Conversion to a Function Pointer
    • IIFE - Immediately Invoked Function Expression
    • Inheriting from a Lambda
    • Summary
  • 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
    • Summary
  • 4. Lambdas in C++17
    • constexpr Lambda Expressions
    • Capture of *this
    • Updates To IIFE
    • Deriving from Multiple Lambdas
    • Summary
  • 5. Lambdas in C++20
    • A Quick Overview of the Changes
    • Template Lambdas
    • Concepts and Lambdas
    • Changes to Stateless Lambdas
    • Lambdas and constexpr Algorithms
    • C++20 Updates to the Overloaded Pattern
    • Summary
  • References
  • Notes

Authors have earned$8,948,210writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

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.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub