Re: [Boost-users] Deferred Function calls

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Matt Davies Sent: Tuesday, October 24, 2006 4:33 PM To: boost-users@lists.boost.org Subject: [Boost-users] Deferred Function calls
I am implementing a signal & slots implementation with a twist. Normally when a signal is fired the connected slots are called immediately. I will need to defer the actual calls to be invoked later. Basically I need to store the function reference (via pointer or functor) and the accompanying parameter values to a 'composite' object. This composite object will be stored on a buffer. Later another processor will pick this object of the buffer and then invoke the actual function call.
[Nat] Let me try to paraphrase the question to see if I understand. You aren't directly using Boost.Signals because when you call a signal it immediately passes control to each of its slots. Your slots have non-empty parameter signatures. The code that triggers the deferred call has matching argument values. If an immediate call were acceptable, you'd simply use a boost::signal and call it with those argument values. So... as Delfin Rojas suggested, you could use boost::bind to bind your boost::signal object with the argument values you later want passed to each connected slot. (I haven't tried this myself.) In the absence of bind placeholders (e.g. _1), bind will produce a nullary functor that you can store in a boost::function<void (void)>. When you later call that functor with no arguments, it should call each connected slot with the bound arguments. If this doesn't answer your question, please explain what we're missing.
participants (1)
-
Nat Goodspeed