I face a problem when trying to bind a method with std::function and std::bind.
In my CommunicationService class :
this->httpServer->BindGET(std::bind(&CommunicationService::ManageGETRequest, this, std::placeholders::_1));
CommunicationService::ManageGetRequest signature :
MessageContent CommunicationService::ManageGetRequest(std::string uri, MessageContent msgContent)
BindGET signature :
void RESTServer::BindGET(RequestFunction getMethod)
RequestFunction typedef :
typedef std::function<MessageContent(std::string, MessageContent)> RequestFunction;
The error on BindGET :
error C2664: 'void RESTServer::BindGET(RequestFunction)': cannot convert argument 1 from 'std::_Binder < std::_Unforced,MessageContent (__cdecl communication::CommunicationService::* )(std::string,MessageContent),communication::CommunicationService *const ,const std::_Ph < 1 > & >' to 'RequestFunction'
Before, my RequestFunction was like that :
typedef std::function<void(std::string)> RequestFunction;
and it worked perfectly. (with all signature methods adjusted of course).
I don't understand what causes the error.
Aucun commentaire:
Enregistrer un commentaire