Modern C++: Lambdas

Modern C++: Lambdas

47mIntermediate2024-03-21

Authors

Nina Ranns

Nina Ranns

Course details

The course provides an introduction to a modern C++ feature called lambdas, which allows developers to create function definitions in place that can be passed around and used in your code. Lambdas improve code readability and make it easier to use standard library algorithms. The course does not require any previous knowledge of lambdas, but does require a basic understanding of C++ notions such as function calls, variables, scope of definition, and standard library. Join instructor Nina Ranns as she offers insights into the fundamentals of lambda syntax and use, with examples of how to use lambdas with standard library algorithms, lambda captures, closure types, generic lambdas, and more.

Skills covered

Software Design PatternsC++Programming LanguagesOpen SourceSoftware DevelopmentOne-Off

Concepts

Introduction

  • Be a C++ Lambda MVP

Lambda Basics

  • What is a lambda
  • Lambda syntax
  • Closure type and closure objects
  • Lambdas and standard library algorithms
  • Conversion to function pointer

Lambda Capture

  • Lambda capture
  • Init captures
  • Capturing this
  • Mutable lambdas

Closure Type Deep Dive

  • Understand the closure type
  • Lambda exception specification
  • Lambdas and compile time evalution

Generic Lambda

  • Generic lambda
  • Introduce template parameters
  • Constrain a generic lambda

Conclusion

  • Closure
40,000 Toman