c++有关于lambda返回值问题 都是对的。。。

#include
using namespace std;
int f4(){
int a=3,b=4;
auto f= a,b->int{
if(a>b)
return i;
else
return -i;
};
cout<<f(1)<<endl;

}

int main(){
f4();
return 0;
}
//****************为什么上下都是对的*************
#include
using namespace std;
int f4(){
int a=3,b=4;
auto f= a,b{
if(a>b)
return i;
else
return -i;
};
cout<<f(1)<<endl;

}

int main(){
f4();
return 0;
//下面这个应该有问题吧

你指的是什么不对呢?语法吗?这应该是正确的,因为很多元素都是可以省略的
参考http://blog.csdn.net/albertsh/article/details/58232824