当前位置: 首页 > 工具软件 > Lam > 使用案例 >

lam 表达式比较

仉成益
2023-12-01
vector<int> myv;
myv.push_back(19);
myv.push_back(18);
myv.push_back(17);
myv.push_back(16);


int x = 10;
int y = 11;
auto func = [&x,&y](int a) {a = a + x; y = 33;cout << a << endl;};
for_each(myv.begin(), myv.end(), func);
for_each(myv.begin(), myv.end(), [=](int a) {cout << a +y << endl;});

return 0;


int a = 10;
auto func = [a](int x)mutable->int {a = 9;return x + a;};
cout << func(2) << ";;"<<a << endl;
return 0;

 类似资料: