I want to write a small program to learn C++ 11 multi-thread program. so I decided to write a mergeSort to test it.
Here is my code:
void mergeSort(int a[], int low, int high)
{
if (high <= low)
{
return;
}
int mid = low + (high - low) / 2;
//single_thread
/*mergeSort(a, low, mid);
mergeSort(a, mid + 1, high);
merge(a, low, high);*/
//multi_thread
thread left(mergeSort, a, low, mid);
thread right(mergeSort, a, mid + 1, high);
left.join();
right.join();
merge(a, low, high);
}
But when I complier the code in VS2015, it will throw an error that no instance of constructor "std::thread" matches the argument list.
can you help me find the problem with my code?
Thx
Aucun commentaire:
Enregistrer un commentaire