想要將boost :: bind傳遞給期望普通函數指針(相同簽名)的方法。將boost :: function降級爲普通函數指針
typedef void TriggerProc_type(Variable*,void*);
void InitVariable(TriggerProc_type *proc);
boost::function<void (Variable*, void*)> triggerProc ...
InitVariable(triggerProc);
error C2664: 'InitVariable' : cannot convert parameter 1 from
'boost::function<Signature>' to 'void (__cdecl *)(type *,void *)'
我可以避免存儲一個boost ::功能,只需直接通過綁定仿函數,但後來我得到類似的錯誤:
error C2664: 'blah(void (__cdecl *)(type *,void *))' : cannot convert parameter
1 from 'boost::_bi::bind_t<R,F,L>' to 'void (__cdecl *)(type *,void *)'
將數據放入回調而不綁定到回調函數的唯一方法是通過一個免費對象 – 2009-02-05 04:29:21