/Cplusplus_Lambda

This repo explains the mechanism of creating and using lambdas in C++11 onwards. It also explains how and when to use these lambdas

Primary LanguageC++MIT LicenseMIT

C++14 Lambdas : You've got in-place anonymous functions

Youtube link of the video Tutorial of this Page

C++ Lambdas (C++11/14) are used widely for writing in-place functions and generally enhances the functionality of C++. Though in-place anonymous function definition is relatively new to C++ as compared to many other languages, but extremely easy to understand and make use of

This intro is divided into various modules to make it easy to learn C++ lambdas

Module - 1 : Syntax of lambdas

This module will describe the basic syntax and usage of lambdas in C++

Module - 2 : Usage of lambdas with names

This module described attaching names to lambdas so that it can also be used in places other than places of origin

This module will also touch upon std::function as well as plan old 'C' style usage function pointers for lambdas

Module - 3 : Using return type with lambdas

Just like any other functions, lambdas can also return values. The return syntax is bit awkward but pretty simple once used to. This module will help understand usage of return in C++ lambdas

Module - 4 : Lambdas : The capture list

This module explains [The Capture List] of lambdas. The functionality associated with the square brackets of lambdas. Here once can use local variables (by values as well as by reference) without passing the variables in the function