
2 Oct
2006
2 Oct
'06
11:51 a.m.
Johan Torp wrote:
I often tend to have interfaces which take a boost::function
that is to be called when an event occurs. Quite often I need make two separate function calls as response to one event. In these cases I usually solve the problem using the following technique: void foo(); void bar();
void call_two(const boost::function
& one, const boost::function & two) { one(); two(); } boost::function
on_event = boost::bind(&call_two, boost::bind(&foo), boost::bind(&bar));
Why not just use Boost Signals to have a single signal just call your two different slots of foo and bar ? It seems you are unnecessarily trying to re-invent a wheel which has already been re-invented by the signals library.