C++ Lambda Story
C++ Lambda Story
Free!
Minimum price
$5.95
Suggested price
C++ Lambda Story

Last updated on 2019-04-04

About the Book

This short 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. You'll learn about all the elements of a lambda expression and even some tricks. This is the longest chapter as we need to cover a lot of topics.
  • C++14 - updates. Once lambdas were adopted, we saw some options to improve them.
  • C++17 - more improvements, especially by handling `this` pointer and allowing `constexpr`.
  • C++20 - in this section we'll have a glimpse overview of the future.

The book contains updated versions of two articles that appeared at bfilipek.com:

I added more examples and better descriptions to describe lambdas in a better way!

The articles also are based on a live coding presentation given by C++ Expert Tomasz Kamiński at our local Cracow C++ User Group.

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.

Table of Contents

  • About the Book
    • Who This Book is For
    • Reader Feedback
  • About the Author
  • Acknowledgement
  • Revision History
  • 1. Lambdas 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
    • IIFE - Immediately Invoked Function Expression
    • Conversion to a Function Pointer
    • 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
    • Summary
  • 5. Future with C++20
    • Quick Overview of the Changes
    • Template Lambdas
    • Summary
  • References
  • Notes

Authors have earned$8,182,613writing, 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. Free App. 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), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). 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