64,642
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <future>
#include <chrono>
using namespace std;
int main(int argc, char **argv){
packaged_task<void()> pt([](){this_thread::sleep_for(std::chrono::seconds(3));cout<<"pt fin"<<endl;});
auto f=pt.get_future();
pt();
cout<<"main fin"<<endl;
return 0;
}