C++ Language/Std/Stl/CallableObjects/Lambda
Just like an int
has a literal form (e.g., 123
), a callable-object has a literal form called a "lambda".
In this example, the literal is being assigned to a callable-object variable:std::function<int(int,int)> DoMath;
DoMath = [](int x, int y) {
return x + y;
};
Additional information about lambdas (includes interactive examples)