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!
Auf dieser Seite können Sie das Online-Video Learning by doing :: C++ -- Lambda Expressions in C++ mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Einsteinzee 18 Juni 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 96 Mal angesehen und es wurde von 4 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!