
AMDG Igor R wrote:
Hello,
I've got the following design: several functors ("Tasks"), when executed, "delegate" to a shared Processor object that performs some coordination between the tasks. The Processor runs the tasks at some stage, and wants to be notified by the task when it's over. However, I wouldn't like them to "know" each other. I even wouldn't like the Processor making assumptions about exact Task's "connection point" signature/name. For this purpose I want the Task to pass its "connection point" as a generic functor - so that the Processor would execute it to subscribe. However, I haven't managed to bind signal::connect. I'd appreciate any idea about what's wrong in the following schematic code: (In the real code the life-time of the objects is managed by means of shared/weak pointers, which are omitted here for the sake of simplicity!)
Can't you pass a boost::signal rather than a boost::function that connects to the signal? Otherwise, try making a function object (untested): struct connect { typedef void result_type; template<class Signal, class F> void operator()(Signal& signal, const F& f) { signal.connect(f); } } ... boost::bind(connect(), boost::ref(done_), _1) In Christ, Steven Watanabe