
Hello,
I'm using Boost.Signals to implement Deferreds
(http://twistedmatrix.com/projects/core/documentation/howto/defer.html).
An important feature of Deferreds is the hability to chain callbacks.
Speaking of Signals, I want a way to call slots using args from
previous slots calls.
For example:
float square(float x) { return x*x; }
float sum1(float x) { return x+1; }
boost::signal

-----Original Message-----
From: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] On Behalf Of Allan Douglas
Sent: Thursday, February 15, 2007 1:03 AM
To: boost-users@lists.boost.org
Subject: [Boost-users] [signals] Chaining slots
For example:
float square(float x) { return x*x; }
float sum1(float x) { return x+1; }
boost::signal

[Nat] Sounds to me like a custom Combiner.
Yes, it sounds like a custom container. But I can't figure out how the slot call argument can be changed. Deferencing the provided InputIterator calls the slot with the default argument, AFAIK.

-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Allan Douglas Sent: Thursday, February 15, 2007 11:03 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [signals] Chaining slots
[Nat] Sounds to me like a custom Combiner.
Yes, it sounds like a custom container. But I can't figure out how the slot call argument can be changed. Deferencing the provided InputIterator calls the slot with the default argument, AFAIK. [Nat] You're right. Now the question is whether the machinery underlying the Combiner iterator-dereferencing mechanism is available for public consumption, or is messy implementation detail. For that I'll have to defer to someone more familiar with Boost.Signals internals.

Nat Goodspeed wrote:
[Nat] You're right. Now the question is whether the machinery underlying the Combiner iterator-dereferencing mechanism is available for public consumption, or is messy implementation detail. For that I'll have to defer to someone more familiar with Boost.Signals internals.
The iterator approach is clearly an abstraction and the call mechanism, especially the argument binding, which would be interesting here, is an implementation detail. I don't think Signals are meant to support this kind of inter-slot dependency. How about simply using a "reference to state" as argument for the slots instead of trying to get the result used by value for subsequent calls. Regards Timmo Stange
participants (3)
-
Allan Douglas
-
Nat Goodspeed
-
Timmo Stange