Guest User

Untitled

a guest
Jul 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. int n = [] (int x, int y) { return x + y; }(5, 4);
  2. cout << n << endl;
  3.  
  4.  
  5. // Assign the lambda expression that adds two numbers to an
  6. // auto variable.
  7. auto f = [n] (int x, int y) { return x + y + n; };
  8.  
  9. n = 0;
  10.  
  11. // Invoke the function object and print its result.
  12. cout << f(21, 12) << endl;
Add Comment
Please, Sign In to add comment