私は機能を持っています:
std::function<void(sp_session*)> test(void(MainWindow::*handler)())
{
return ...;
}
ハンドラーの型を同等の std::mem_fn 型に置き換えたいと思います。
タイプは何ですか?
私はこれを試しました:
std::function<void(sp_session*)> test(std::mem_fn<void(), MainWindow> handler)
{
return ...;
}
しかし、VC++ 2010 は次のエラーを吐き出します。
error C2146: syntax error : missing ')' before identifier 'handler'
error C2059: syntax error : ')'
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)
だから私は何が間違っていたのか分かりません。