我有以下接口:
template <class T>
class AbstractTask {
public:
virtual void BindTaskCompleted(AbstractTask<T> &bindedTask)=0;
virtual void Join(TaskResult<T>)=0;
};
并且:
template <class T>
class SlaveTask: public AbstractTask<T> {
public:
typedef boost::function<void(TaskResult<T>)> joinFunction;
void BindTaskCompleted(AbstractTask<T> &bindedTask)
{
/////////////WORK OK//////////////////////////////
//bindedTask.Join(result);
/////////////COMPILATION ERROR/////////////////////
slaveTaskCompletionFunction=boost::bind(&AbstractTask<T>::Join,bindedTask,result);
}
void Join(TaskResult<T> r)
{
slaveTaskCompletionFunction(r);
}
private:
joinFunction slaveTaskCompletionFunction;
TaskResult<T> result;
};
I m试图将执行摘要Task的虚拟Join方法学捆绑起来,以促进:与同一签名相操作。 助推:Bbind投掷了77个汇编错误,我看不出原因。
I thought at first that boost::bind couldn t be use with virtual method but this doesn t seem to be the case: Virtual function and boost bind strange behavior
事先感谢你们的帮助!
Thomas