Boost logo

Boost Users :

Subject: Re: [Boost-users] Handler requirement for Asynchronous Operations in boost::asio
From: Igor R (boost.lists_at_[hidden])
Date: 2011-12-19 12:07:39


> It is specified in http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/reference/AcceptHandler.html
> that a handler for `async_accept()` must satisfy the following function
> signature:
>
>     void accept_handler(
>         const boost::system::error_code& ec)
>     {
>       ...
>     }
>
> However, in the `Daytime.3` example, using boost::bind, the handler can be
> specified as much parameter as desired, as long as it does not exceed the
> limit of `boost::bind` (which is 9 arguments at maximum):
<...>
> Why is that possible? I thought even with `boost::bind`, the exact function
> signature still has to be matched.

It is possible, because bind creates a functor that exposes operator()
having the number of arguments that matches the expectations of the
completion handler caller.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net