Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int n = [] (int x, int y) { return x + y; }(5, 4);
- cout << n << endl;
- // Assign the lambda expression that adds two numbers to an
- // auto variable.
- auto f = [n] (int x, int y) { return x + y + n; };
- n = 0;
- // Invoke the function object and print its result.
- cout << f(21, 12) << endl;
Add Comment
Please, Sign In to add comment