I should clarify, this is what I want to achieve:
boost::function
You will want to learn a bit more about Boost.Bind. You can bind your pointer or variable at the bind call. Parameters at the time of bind are copied by value. If you need a reference use the boost::ref wrapper.
Expanding your example:
void DClient::resolveHandler( const boost::system::error_code& error, int value ); ... int special_number = 42;
hostResolver->async_resolve( *nameQuery, boost::bind(&DClient::resolveHandler, this, boost::asio::placeholders::error, special_number ) );
-------------------
In the above, when the handler is invoked it will pass the error value (via the placeholder) and the value of special_number during the bind... which is 42.
If I understand you correctly, then in the following code:
void DClient::resolveHandler(int param)
{
....
}
boost::function