vendredi 2 janvier 2015

how to pass multidimensional array in multithreading c++

I was trying to create multithreading to handle 2 multi-dimensional arrays:



vector<thread> tt;
for(int i=0;i<4;i++) tt.push_back(thread(th,arr1,arr2));


with the threaded function :



void th(int arr1[3][100][100], int arr2[100][100]) {
...
}


I also tried to pass by reference yet not get it work as well:



void th(int (&arr1)[3][100][100], int (&arr2)[100][100]) {
...
}


Both of them gives me an "no type named 'type' in 'class std::result_of void(* (int **[])..." error. Can someone please show me how to correctly pass multidimensional arrays in multithreading?


Aucun commentaire:

Enregistrer un commentaire