fork download
  1. #include <iostream>
  2. #include <functional>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. auto adder = [](int x){ return [x](int y) { return x+y; }; };
  9. auto add4 = adder(4);
  10. cout << add4(6) << endl;
  11.  
  12. return 0;
  13. }
  14.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
10