defining a function according to a signature given as template parameter

Hi everybody,
I'd like to have a generic wrapper that can be put "in between" a signal and a
slot to provide some additional functionality to the slot.
So where I normally have something like
void myslot(int i)
{
std::cout << "slot(" << i << ")\n";
}
int main(int argc, char *argv[])
{
boost::signal

On Monday 08 October 2007 10:43, Stefan Funck wrote:
Is that doable? So far I have two questions: 1) How can I define a member function according to the signature that is given as a template parameter to the class? 2) If I can do 1), how can I then bind the arguments given and call another function, i.e. the original slot?
It's a pain. You might look at the implementation of boost.function or boost.signal. I did both of the things you're asking about in the slot class of thread_safe_signals, using the boost preprocessor to generate all of the slotN classes. -- Frank

Frank Mori Hess
On Monday 08 October 2007 10:43, Stefan Funck wrote:
Is that doable? So far I have two questions: 1) How can I define a member function according to the signature that is given as a template parameter to the class? 2) If I can do 1), how can I then bind the arguments given and call another function, i.e. the original slot?
It's a pain. You might look at the implementation of boost.function or boost.signal. I did both of the things you're asking about in the slot class of thread_safe_signals, using the boost preprocessor to generate all of the slotN classes.
I had a quick look into signal's implementation before and was a bit frightened, hoping that my problem might be somehow easier to solve ... One more thing I couldn't really figure out so far: what is the difference between slot_type and slot_function_type? Thanks for your help, Stefan
participants (2)
-
Frank Mori Hess
-
Stefan Funck