This list, has to hold functions, they might be from different namespaces and even methods of instanced classes.
This list will then be iterated and all the functions and methods called. It would be nice if they could contain arguments also.
I was thinking on using a std::vector, but I suspect that I am far from correct in that guess.
What approach do you recommend me? All help is welcome.
Have all of your functions implement the Command Pattern.
Your list becomes a
As you iterate over the list, you invoke the Execute() method of each list item.
For example, say you have a simple Command interface called Commander:
And you have three objects that you want to put in your list: A Greyhound, a Gyrefalcon, and a Girlfriend. Wrap each in a Commander object that calls the object’s function of interest. The Greyhound runs:
The Gyrefalcon flies:
And the Girlfriend squawks:
Stuff the Commander objects in your list. Now you can iterate over them and invoke each element’s Execute() method: