I have a several functions with varying types of arguments:
static void fn1(int* x, int* y);
static void fn2(int* x, int* y, int* z);
static void fn3(char* x, double y);
...
I'd like to create a new function that takes in a collection of function pointers, a collection of argument values, and executes each function in the collection, in sequence, with the correct argument values:
static void executeAlgorithm(
vector<FN_PTR_TYPE> functionToExecute,
map<FN_PTR_TYPE, FN_ARG_COLLECTION> args)
{
// for each function in 'functionToExecute',
// get the appropriate arguments, and call the
// function using those arguments
}
What's the cleanest way to achieve this behavior?
std::vector<std::function<void()>>; the arguments then just to into the function wrapper.std::variant<void(*)(int*, int*), ...>but I don't think that would end up being clean...