【发布时间】:2015-02-05 05:47:07
【问题描述】:
class A
{
public:
int xx(int size)
{
}
public:
int xx(int size)
{
}
int yy(int size)
{
}
};
int main()
{
typedef int (A::*functions)(int);
std::vector<functions> methods =
{
&A::xx,
&A::yy
};
A aa;
boost::thread_group thgrp;
for (typename std::vector<functions>::iterator itr=methods.begin();itr!=methods.end();++itr)
{
functions z=*itr;
boost::thread *t=new boost::thread(z,aa,10);
thgrp.add_thread(t);
}
thgrp.join_all();
return 0;
}
我收到一个错误“没有匹配的函数调用'get_pointer'”。 我想使用 boost 线程从我的预定义类型的向量中调用方法。
请帮我解决这个问题!
【问题讨论】:
-
也许发送
&aa? -
...这不是有效的 C++ 代码。
A类有两个成员,它们具有相同的名称 (xx) 和签名 (int)。xx和yy都没有返回任何内容,但被声明为这样做。
标签: c++ boost boost-thread