I was doing a project that uses threads to sum some matrix but at the time of creating the threads and adding the params it always shows up the same error. Any ideas?
void sum(std::vector <double>& matrix, std::vector <double>& other) {
for (auto i = 0; i < 15; i++) {
matrix[i] += other[i];
}
}
here it is the operation that threads should do.
std::vector <double>* mat1 = new std::vector <double>[15];
std::vector <double>* mat2 = new std::vector <double>[15];
std::vector <std::thread*> threads;
for (int j = 0; j < 15; j++) {
sum(mat1[j], mat2[j]); //this works;
threads.push_back(new std::thread(sum,mat1[j],mat2[j])); //this dont why?;
}
Thanks in advance