Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个有两种方法的类
bool Syntax::removeTarget( CommandParam ¶ms );
和
bool Syntax::removeTarget( const std::string & targetId );
如何绑定第二种方法?boost::bind(&Syntax::removeTarget, this, _1)不起作用。
boost::bind(&Syntax::removeTarget, this, _1)
为了消除重载的歧义,您必须将它们强制转换(或强制)为正确的类型。这应该有效:
boost::bind(static_cast<bool (Syntax::*)(const std::string&)>(&Syntax::removeTarget), this, _1);