编码:
class Base{
enum eventTypes{ EVENT_SHOW };
std::map<int, boost::function<bool(int,int)> > m_validate;
virtual void buildCallbacks();
bool shouldShowEvent(int x, int y);
};
void Base::buildCallbacks(){
m_validate[ EVENT_SHOW ] = boost::bind(&Base::shouldShowEvent,this);
}
我收到以下错误:
In base.cxx
return (p->*f_);
Error: a pointer to a bound function may only be used to call
the function (boundfuncalled)
我得到了错误的意思,除了调用有界成员函数之外,我不能做任何其他事情,但是我该如何规避这个问题呢?我不确定为什么这不起作用。