有没有办法使用"new"关键字初始化堆上的std::thread
?
不要使用 new,请使用make_unique
沿着这条线的东西:
#include<thread>
#include<memory>
bool fun1()
{
return true;
}
int main() {
auto thread1 = std::make_unique<std::thread>( fun1 );
thread1->join();
}