First, let's look at how lambdas are implemented in C++. It is similar in flavor to the way lambdas are implemented in C#, but the details are all different. When the C++ compiler encounters a lambda expression, it generates a new anonymous class. Each captured variable becomes a member of that anonymous class, and the member is initialized ...