Lambdas - the old, the new and the tricky

Speaker: Dawid Zalewski

Audience level: Beginner | Intermediate

Lambda expressions have been in the language since C++11. Over the years they evolved, gaining the hidden generic powers in C++14 or having some details, like the ability to capture a copy of the enclosing object, polished in C++17. C++20 brings a handful of additions to their extensive feature set, including explicit lambda templates with concepts, default-constructible stateless lambdas or the ability to use lambdas in unevaluated context (e.g. template parameter). Those changes not only simplify the use of lambda expressions but also open doors to applications that were not possible before.
In this talk, I will briefly go through the evolution of closures, describing the limitations of the previous specifications and covering the main caveats and traps that await(ed) their users. I will move onto the new features of lambda's in C++20, discussing how they remove those limitations and what new usage scenarios they enable. The talk will conclude with the outlook on what's still not possible with lambda's and how this might change in the future.