【发布时间】:2015-06-23 05:56:54
【问题描述】:
class Foo
{
public:
void method(int a,float b)
{
cout<<"This method takes float and int";
}
void method(char a,char b)
{
cout<<"This method takes two characters";
}
};
在具有上述重载函数的类中,使用 boost::thread newThread(&Foo::method,foo_obj_ptr,a,b) 创建线程会引发错误“没有重载函数需要四论”。 [我仅将 a 和 b 声明为字符。] 我的假设是,使用重载函数 boost::thread 无法正确绑定。对此有任何解决方案吗?
我在 vs2010 中使用 boost 1.54。
【问题讨论】:
-
您需要
static_cast来区分函数与重载集。顺便说一句,这不是 Boost 特有的。 -
告诉我们MCVE
标签: c++ boost overloading