Is there a method/pattern/library to do something like that (in pseudo-code):
task_queue.push_back(ObjectType object1, method1); task_queue.push_back(OtherObjectType object2, method2);
so that I could do the something like:
for(int i=0; i<task_queue.size(); i++) { task_queue[i].object -> method(); }
so that it would call:
obj1.method1(); obj2.method2();
Or is that an impossible dream?
And if there’s a way to add a number of parameters to call – that would be the best.
Doug T. please see this Excellent answer!
Dave Van den Eynde‘s version works well too.
Yes you would want to combine boost::bind and boost::functions its very powerful stuff.
This version now compiles, thanks to Slava!