C++多线程调用类成员函数
创建一个类test:
class test { public: void func() { std::cout<<"test"; } };
main函数多线程调用test成员函数:
int main( int argc, char **argv ) { test *t = new test; std::thread th( &test::func, t ); }
编译成功!
编译器报错:invalid use of non-static member function
修改如下: