What is a C++ lambda? Why do lambdas exist? How can lambdas make your code more expressive?
Understand every detail of the syntax of lambdas, including pitfalls, and how you can avoid them.
Apply Lambdas in Real-World Scenarios
What Does The Book Cover?
The book begins with a brief explanation of why lambdas exist. We'll look at what C++ looked like before lambdas. I can already say that, technically, everything lambdas can do was possible before, BUT with lambdas, code becomes far more expressive and concise. From there, we'll learn about the basics and syntax of lambdas, how a lambda is structured and what it actually is. Many people mistakenly think a lambda is a function, but the truth is that it is a function object, which allows it to store state. We'll explore the syntax in depth, covering specifiers like mutable and even looking at recursive lambdas. We'll also discuss how to store lambdas and the role of std::function. The book concludes by showing various practical applications of lambdas in real-world scenarios. BONUS: The book includes a printable cheatsheet you can hang on your wall to never forget lambda syntax!
Learn From Watching
The book contains many code examples that you are also available online. You will get free access to a GitHub repo that shows all code examples as part of a larger CMake project.
The Face Behind The Doctor
Jelle has been a C++ engineer for over a decade, contributing to a wide range of commercial products, primarily in the area of audio and music software such as audio plugins or desktop applications. He’s driven by a passion for writing high-quality code, and when he realized how many developers struggle to write good C++ code he founded C++ Doctor. Aiming to help others write clean, bug-free C++ through educational content delivered via newsletters, LinkedIn, eBooks and other products. C++ Doctor also provides C++ code reviewing and consultancy on request.
What People Are Saying
Find out why others are loving this C++ Lambdas book
I did not know the performance benefits of lambdas vs std::functions. The whole function object thing really clicked for me when reading the book. It makes sense that () is an operator like anything else. Also, using a template rather than passing in std::function is pretty slick. Just used that today!
Founder @ DeanosDSP
You went down to the smallest details and "put on the tray" many use cases. A very useful book which I recommend with pleasure.
Senior Software Developer (10+ years)
Read it if you are unfamiliar with lambdas and want to know what all the possibilities are. It very clear and easy to follow.
Audio Developer (1-3 years)
Let Your Code Speak
I guarantee you that this small investment will make you fall in love with C++ Lambdas, and you'll begin to use them everywhere! Your code will transform and be more expressive.
€9,99