Can somebody enlighten me what's going on
#include <functional>
#include <boost/asio.hpp>
int main() {
typedef boost::asio::ip::tcp::resolver resolver;
boost::asio::io_service io;
resolver res(io);
// typical way to call the resolver is (this works)
// res.async_resolve(resolver::query("google.com", ""), [](const boost::system::error_code &, resolver::iterator){});
// this line fails with 'no matching function call to bind'
auto bound_resolver = std::bind(&resolver::async_resolve, res, resolver::query("google.com"), std::placeholders::_1);
bound_resolver([](const boost::system::error_code &, resolver::iterator){});
io.run();
}
The compile error
test.cpp:13:27: error: no matching function for call to 'bind'
auto bound_resolver = std::bind(&resolver::async_resolve, res, resolver::query("google.com"), std::placeholders::_1);
^~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/functional:1623:5: note: candidate template ignored: couldn't infer template argument '_Func'
bind(_Func&& __f, _BoundArgs&&... __args)
^
/usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/functional:1650:5: note: candidate template ignored: couldn't infer template argument '_Result'
bind(_Func&& __f, _BoundArgs&&... __args)
^
1 error generated.