1
我正在嘗試使用boost::bind
並使用boost::function
。 這似乎是一個微不足道的例子,但我不能讓它工作。你可以幫我嗎?即使使用此提升也不會綁定到成員函數
是因爲它不被允許或者我做錯了什麼?
// .h
class MyClass{
publc:
void DoSomething(
const std::string& a,
const std::string& b);
void DoABind();
}
//.cpp
void MyClass::DoABind(){
boost::function< void(const std::string& , const std::string&) > callback(
boost::bind(
&MyClass::DoSomething,
this));
// this line doesn't compile!!!
}