std::function<void(const tstring&)> m_funShowMessage = nullptr;
std::function<void(const USHORT*, USHORT&)> m_funShowCurve = nullptr;
template <typename F>
void RegisterCallBack(int id, F func)
{
switch (id)
{
case CB_SHOWMESSAGE:
m_funShowMessage = func;
break;
case CB_SHOWCURVE:
m_funShowCurve = func;
break;
default:
break;
}
}
// 调用
RegisterCallBack(CB_SHOWMESSAGE, std::bind(&BRControlForm::ShowMessage, this, std::placeholders::_1));
RegisterCallBack(CB_SHOWCURVE, std::bind(&BRControlForm::ShowCurve, this, std::placeholders::_1, std::placeholders::_2));
代码编译报错:
尝试匹配参数列表“(std::function<void (const std::wstring &)>, F)”时
with
[
F=std::_Binder<std::_Unforced,void (__thiscall BRControlForm::* )(const USHORT *,USHORT &),BRControlForm *,const std::_Ph<1> &,const std::_Ph<2> &>
]