Boost logo

Boost Users :

Subject: Re: [Boost-users] Handler requirement for Asynchronous Operations in boost::asio
From: Tu Hoang Do (solidius4747_at_[hidden])
Date: 2011-12-19 23:46:47


I found a very good explanation here:
http://blog.think-async.com/2010/04/bind-illustrated.html

On Tue, Dec 20, 2011 at 12:07 AM, Igor R <boost.lists_at_[hidden]> wrote:

> > 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users



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