I am trying to run a simple lambda example.
// lambda.cpp #include <functional> //#include <tr1/functional> int main() { // Assign the same lambda expression to a function object. function<int (int, int)> f2 = [] (int x, int y) { return x + y; }; //function<int (int, int)> f2 = [] (int x, int y) { return x + y; }; } I'm compiling it like this:
$ g++ -std=c++0x -fpermissive lamdas.cpp lambdas.cpp: In function ‘int main()’: lambdas.cpp:10: error: expected primary-expression before ‘=’ token lambdas.cpp:10: error: expected primary-expression before ‘[’ token lambdas.cpp:10: error: expected primary-expression before ‘]’ token lambdas.cpp:10: error: expected primary-expression before ‘int’ lambdas.cpp:10: error: expected primary-expression before ‘int’ lambdas.cpp:10: error: expected ‘;’ before ‘{’ token How do I get it to compile with no errors?
Λάμβδα(orλ) in order to be totally standards conforming :)