Skip to content

Instantly share code, notes, and snippets.

@cblp
Created December 13, 2018 12:04
Show Gist options
  • Save cblp/8c58096c79f49749791a635999a76b22 to your computer and use it in GitHub Desktop.
Save cblp/8c58096c79f49749791a635999a76b22 to your computer and use it in GitHub Desktop.
#include <functional>
#include <iostream>
using namespace std;
function<int(int)> add(int x) {return [=](int y){return x + y;};}
int main() {
cout << add(1)(2) << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment