Boost logo

Boost Users :

Subject: Re: [Boost-users] Asio and bind. Queuing a bind call.
From: Nat Linden (nat_at_[hidden])
Date: 2010-11-05 12:14:30


On Fri, Nov 5, 2010 at 7:08 AM, <Nick.Adamson_at_[hidden]> wrote:

As the result of boost::bind is a template I don't know of an stl or boost
> container which will store these objects.
> As there are a number of functions that can be called on my resource with
> differing arguments I don't think I can use a boost::function as I don't
> know the arguments to my generic post call.
>

I think boost::function<void()> may be exactly what you want. The usage
would be to boost::bind() your function with all the desired argument
values: I'm assuming you already know these before you decide whether the
resource is ready to service the function call. Then you can simply call the
resulting object with no additional arguments. Everything it needs is
already bound.

Then it's easy to decide whether to call it immediately, or put it in a
std::queue< boost::function<void()> >.



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