#include <thread>
void f(int*& ptr)
{
ptr = new int[4];
ptr[0] = 0;
ptr[1] = 1;
ptr[2] = 2;
ptr[3] = 3;
}
int main()
{
int* ptr;
std::thread thread{ f, ptr };
thread.join();
delete[] ptr;
return 0;
}
我不明白我在想什么。我尝试了引用或非引用的不同组合,请检查我是否具有与文档中相同的格式。没有。我仍然收到此错误:
错误C2672'std :: invoke':找不到匹配的重载函数