#include <thread>
#include<iostream>
using namespace std;
void main_3(){
int res=0;
int a=234;
int b=234;
thread myt([&res](int a,int b){
res=a+b;
cout<<"computed a+b"<<endl;
},23,4);
// cout<<"computed a+b: "<<res<<endl;
myt.join();
cout<<"computed a+b: "<<res<<endl;
}
lambda表达式使用
最新推荐文章于 2024-08-17 23:59:05 发布