boost::bind composition inside io_service::post function
问题 Given the following class class task_counter { public: task_counter(short, boost::asio::io_service&); ~task_counter(void); template<typename CompletionHandler> void exec_task(CompletionHandler handler) { grant_access(); io_.post(boost::bind(&task_counter::exec_and_decrease_counter<CompletionHandler>, this, handler)); } template<typename CompletionHandler> void exec_and_decrease_counter(CompletionHandler handler) { handler(); decrease_counter(); } private: .... } Method exec_task is called by