error: no type named ‘type’ in ‘class std::result_of<std::_Bind<void (*(std::_Placeholder<1>, std::_Placeholder<2>, int, std::_Placeholder<3>))(const int*, int, int, double&)>(int*, int, double)>’
typedef typename result_of<_Callable(_Args...)>::type result_type;<br>
auto cvf= bind(computeVarFactor,_1,_2,total_items,avg,_3);
thread *t1=new thread[num_threads];
for(int i=0;i<num_threads;i++)
{
t1[i]=thread(cvf,&data[p_indices[i]],(p_indices[i+1]-p_indices[i]),variances[i]);
}
//JOINING THE THREADS
for(int i=0;i<num_threads;i++)
{
t1[i].join();
}
void computeAvgFactor(const int* arr, int size, int divisor, double& avg) {
avg = 0;
for (int i = 0; i < size; i++)
avg += arr[i];
avg /= divisor;
}
this is the code I'm sure is causing the problem, yet I've wrecked my brains searching over the internet about what's causing the issue?. I'm hopeful I will find some lead here. Thanks.
Aucun commentaire:
Enregistrer un commentaire