I am looking everywhere (Modern C++ design & co) but I can\'t find a nice way to store a set of callbacks that accept different arguments and operate on different classe
Use std::function
to store the calls and then use a variadic template argument to forward and bind the function parameters:
class Clock
{
vector> tasks;
template
void defer(F f, Args&&... args)
{
tasks.push_back(bind(f, forward(args)...);
}
}
void f(A a, B b);
int main()
{
A a;
B b;
Clock c;
c.push_back(f, a, b);
}
see also std::bind
and std::mem_fun