假设我有一个类如
class c {
// ...
void *print(void *){ cout << "Hello"; }
}
Run Code Online (Sandbox Code Playgroud)
然后我有一个c的向量
vector<c> classes; pthread_t t1;
classes.push_back(c());
classes.push_back(c());
Run Code Online (Sandbox Code Playgroud)
现在,我想创建一个线程 c.print();
以下是给我以下问题: pthread_create(&t1, NULL, &c[0].print, NULL);
错误输出:无法将'void*(tree_item :: )(void)'转换为'void*()(void)'以将参数'3'转换为'int pthread_create(pthread_t*,const pthread_attr_t*,void*()(void),void*)'