Question

I would like to use lambda equation. In the C++ Builder XE4, I tried the following.

#include <boost/mpl/lambda.hpp>

auto add = [] (int a, int b)-> int{ return a + b; };

However, I got "E2188: Expression syntax" error.

What is the problem?

I am sure that the boost library is correctly installed on my environment.

Was it helpful?

Solution

There is no issue with code. Compile with c++11.

auto add = [] (int a, int b)-> int{ return a + b; };
cout<<add(2,3);

http://ideone.com/PGSmXh
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top