mercredi 27 janvier 2016

std::bind() error: cannot determine which instance of overloaded function "boost::asio::io_service::run" is intended

While trying to compile this in Visual C++ 2015

  auto worker = std::bind(&boost::asio::io_service::run, &(this->service));

I'm getting errors:

error C2783: 'std::_Binder<_Ret,_Fx,_Types...> std::bind(_Fx &&,_Types &&...)': could not deduce template argument for '_Ret'
note: see declaration of 'std::bind'

error C2783: 'std::_Binder<_Ret,_Fx,_Types...> std::bind(_Fx &&,_Types &&...)': could not deduce template argument for '_Fx'
note: see declaration of 'std::bind'

error C2783: 'std::_Binder<std::_Unforced,_Fx,_Types...> std::bind(_Fx &&,_Types &&...)': could not deduce template argument for '_Fx'
note: see declaration of 'std::bind'

Additionally, IntelliSense complains with:

cannot determine which instance of overloaded function "boost::asio::io_service::run" is intended

I see that there are 2 overloads of boost::asio::io_service::run. But how can I specify which one to use?

With boost::bind the code compiles just fine:

  auto worker = boost::bind(&boost::asio::io_service::run, &(this->service));

Aucun commentaire:

Enregistrer un commentaire