#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;
}
I don't understand what I'm missing. I tried different combinations of reference or non-reference, checked whether I have the same format as in the documentation. Nothing. I still get this error:
Error C2672: 'std::invoke': no matching overloaded function found
Aucun commentaire:
Enregistrer un commentaire