I am attempting to run a class-member function in parallel from another class-member function in C++11:
class Class{
int arg1{0};
int arg2{1};
int arg3{2};
public:
void test (){
thread t = thread(&Class::parallelTest, this, arg1, ref(arg2), ref(arg3));
t.join();
}
void prallelTest(int a, int& b, int& c){....}
}
int main(){
Class c{};
c.test();
return 0;
}
but VS 17 shows me the following error:
Severity Code Description Project File Line Suppression State
Error C2280 'std::thread::thread(const std::thread &)': attempting to reference a deleted function Class c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.12.25827\include\xmemory0 945
i searched a little but just found examples for parallel execution from the main function: Simple example of threading in C++
Can anybody please point me in the right direction?
Aucun commentaire:
Enregistrer un commentaire