Skip to content

Instantly share code, notes, and snippets.

@seanjensengrey
Created March 5, 2014 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanjensengrey/9362157 to your computer and use it in GitHub Desktop.
Save seanjensengrey/9362157 to your computer and use it in GitHub Desktop.
#include <functional>
#include <iostream>
// g++ -std=c++11 quad.cpp
int main(int argc,char** argv) {
auto d = [](double x){ return (x * x - 0.5); };
auto adder = [](int x) {
return [=](int y) {
return x + y;
};
};
auto add1 = adder(1);
std::cout << "hello world" << std::endl;
std::cout << d(2.0) << std::endl;
std::cout << add1(2) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment