First-class Functions in C++: Using Lambdas & Closures
In C++ a lambda expression is an ad-hoc locally scoped function object that offers a function definition syntax. Lambdas can be stored in variables and invoked like function objects or function pointers but lambdas go further by supporting context capture. In this course learn how to define and invoke lambda functions and pass and return input arguments to and from lambdas using the Standard Template Library (STL) algorithms. Next explore how context capture works in lambdas and implement closures. Finally work with context capture to specify captured variables and whether the capture is by copy or by reference. Upon completion youll be able to define and invoke a lambda function perform context capture by value and by reference and define closures inside class methods.