Let's say I have two functions:
void a(int arg1) { ... }
void b(int arg1, arg2) { ... }
And I also have a string with the name of the function I want to call, and an array with all parameters:
string func_name = "b"; // 'a' or 'b'
int args[] = { 1, 2 }; // has either 1 or 2 values
I need to call the function dynamically. Doing it with a function that has no arguments is really easy, I just created a map (string function_name => pointer to function).
Now I also want to pass the arguments, so I want to convert an array to actual arguments, something like this:
auto f = std::bind(b, args); // Doesn't compile, requires 1,2 as arguments
I hope the problem is clear and that it is solvable.
Thanks