boost::bind is extremely handy in a number of situations. One of them is to dispatch/post a method call so that an io_service will make the call later, when it can.
In such situations, boost::bind behaves as one might candidly expect:
#include <boost/asio.hpp> #include <boost/bind.hpp> boost::asio::io_service ioService; class A { public: A() { // ioService will call B, which is private, how? ioService.post(boost::bind(&A::B, this)); } private: void B() {} }; void main() { A::A(); boost::asio::io_service::work work(ioService); ioService.run(); } However, as far as I know boost creates a functor (a class with an operator()()) able to call the given method on the given object. Should that class have access to the private B? I guess not.
What am I missing here ?