This video is part of the new series called "Learning by doing :: C++" which is dedicated to random topics in C++. Here we talked about lambda expressions/functions in C++. The general idea of lambda expressions is to make you able to define anonymous/unnamed functions on the fly no matter you are in a function or writing an expression, to carry out simple functionalities. The idea of lambda expressions or closures already existed in many other programming languages (Java, Python, Haskell and ...). It was borrowed and adapted into the context of C++ as part of C++11/modernC++. Please refer to this article : https://www.stroustrup.com/N1968-lamb...
Prior to lambdas you could achieve the same functionality with the concept of function object classes which existed since day one of C++. However, you'll see there is an element of convenience with lambda expressions compared to function objects. Similar to function objects, lambdas are not just functions but they carry also the notion of objects. They can have different access levels(value or reference) to the variables in the scope that they are defined in.
General rule of thumb is to avoid putting heavy duty tasks into lambda expressions as the compiler tries to inline to achieve efficiency.
Hope you learned something from this video. If you have further questions don't hesitate to comment down below. Have fun!
In questa pagina del sito puoi guardare il video online Learning by doing :: C++ -- Lambda Expressions in C++ della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Einsteinzee 18 giugno 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 96 volte e gli è piaciuto 4 spettatori. Buona visione!