I know that this question has already been answered, but when I was looking for the answer to this question, I was looking for something a little different from the answers here, and I think that this may have been what the OP hinted at, therefore here hope this helps someone else.
Say you have a function:
void print(int n) { printf("%i ", n); }
To pass the lambda to this function, you do the following:
print([]{ return 3; }());
This will obviously lead to function 3. A more useful example specifically related to the OP question is a lambda, which takes an integer as a parameter and returns the int function to the final function:
int x = 3; auto lambdaFunction = [](int input) { return (input + 1); }; print(lambdaFunction(x));
It is assumed that you do not follow the value or the link to the lambda, which you can do directly:
// Pass by value print([=]{ return (x + 1); }()); // Pass by reference print([&]{ return (x + 1); }());
Jose Jun 22 '17 at 3:57 on 2017-06-22 03:57
source share