[英]lambda equation in c++
I would like to use lambda equation. 我想使用lambda方程式。 In the C++ Builder XE4, I tried the following.
在C ++ Builder XE4中,我尝试了以下方法。
#include <boost/mpl/lambda.hpp>
auto add = [] (int a, int b)-> int{ return a + b; };
However, I got "E2188: Expression syntax" error. 但是,我收到“ E2188:表达式语法”错误。
What is the problem? 问题是什么?
I am sure that the boost library is correctly installed on my environment. 我确定我的环境中正确安装了boost库。
There is no issue with code. 代码没有问题。 Compile with c++11.
用c ++ 11编译。
auto add = [] (int a, int b)-> int{ return a + b; };
cout<<add(2,3);
http://ideone.com/PGSmXh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.