I want to write a generic template function that accepts and calls a number of different functions and performs additional setup and teardown operations. The functions signatures differ in the first arguments, such as:
void foo(int i, void* self, (*callback)(void*, int i));
void bar(bool s, bool r, void* self, (*callback)(void*, int i));
I also want to pick out the self argument and the callback, but letting the arguments in front of them vary. I understand this must be hard to do with variadric templates due to how the unpacking works; is there any way around it?