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));
Is there any other way to acheive this, beside having to redeclare and
define a function such as call_two?
It seems quite easy to define something like:
template
void nullary_compose boost::function& one, const
boost::function& two);
template
void nullary_compose boost::function& one, const
boost::function& two, const boost::function& three);
...
Is anybody else interested in seeing such templates in boost?
Best Regards,
Johan Torp
--
System Developer
TouchTable AB
Tel: +46 (0)31 773 68 12
johan.torp@touchtable.se