Suppose there's
class concurr{
public:
double arr[100];
void func1(vector<vector<double>> data,int x);
double func2(vector<vector<double>> data);
}
such that func2 takes in "data" and feeds it to func1 with the same "data" but varying numbers of x as it goes from 0 to up to 100. Then in func1, it calculates something and whatever the double value it comes out, fills it up for arr[x] So basically, the func2 looks generally like
double concurr::func2(vector<vector<double>> data){
thread threads[100];
for (int x = 0; x < 100; x++){
threads[x] = thread(concurr::func1,data,x); // this line is where the problem is
}
for (auto& th : threads){
th.join();
}
// ..... does something with the arr[100].... to come up with double = value
return value;
}
and without the multithreading part, the code runs well, it's just that with the added multithreading part, when I try to compile, it says "reference to non-static member function must be called"