일반 함수 포인터 (동일한 서명)를 예상하는 메서드에 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 *)'
내가 유사한 오류 :: 후원을 저장하는 기능을 방지하고 단지 직접 결합 펑을 통과하지만 내가 얻을 수 있습니다 : 당신이 대상을 사용하려는 생각
error C2664: 'blah(void (__cdecl *)(type *,void *))' : cannot convert parameter
1 from 'boost::_bi::bind_t<R,F,L>' to 'void (__cdecl *)(type *,void *)'
'boost :: function pfn = static_cast > (userData); '대신 boost :: function *을 사용해야합니다. 그렇지 않으면 컴파일 오류가 발생합니다. –
Gohan
@Gohan 예, 작성자의 의도였습니다. 게시물을 수정합니다. – Yann