関数ポインタをメソッド呼び出しに渡すサードパーティ ライブラリを使用しています。
class RTSPClient{
public:
...
typedef void (responseHandler)(RTSPClient* rtspClient,
int resultCode, char* resultString);
...
unsigned sendOptionsCommand(responseHandler* responseHandler,
Authenticator* authenticator = NULL);
};
通常の使用方法は次のようになります。
void continueAfterOPTIONS(RTSPClient* client,
int resultCode, char* resultString);
....
RTSPClient* pClient;
....
pClient->sendOptionsCommand(continueAfterOPTIONS, NULL);
次に、continueAfterOPTIONS メソッドをクラスのメンバー関数にしたいと思います。通常、boost::bind を使用してこれを行います。
pRtspClient>sendOptionsCommand(boost::bind(&RtspClientSessionManager::continueAfterOPTIONS, this), NULL);
その結果
error C2664: 'RTSPClient::sendOptionsCommand' : cannot convert parameter 1 from 'boost::_bi::bind_t<R,F,L>' to 'RTSPClient::responseHandler (__cdecl *)'
関数の引数にプレースホルダーを追加しようとしましたが、違いはありませんでした。私がやろうとしていることは可能ですか?おそらくバインド結果をキャストする方法はありますか?
ありがとう!