On the one hand, I have a list of function pointers to a bunch of functions with different signatures stored in a map that maps each function to a function ID. The function pointers are typedefed within templated classes, such as:
typedef R (T::*SetPtr_t) (A)
typedef R (T::*SetPtr_t) (A, B)
typedef R (T::*SetPtr_t) (A, B, C)
etc.
On the other hand, I have another map that maps the same function ID to a block of memory that stores the parameters to the function.
What I'm looking for is an automated way of invoking a function through the function pointer from the first map by passing the arguments stored in a contiguous block of memory from the second map. I'm looking for a way of making it so that I don't have to hand-code each and every case where I would extract the arguments and pass them into the function, as there are hundreds of these functions.
As to the problem we're trying to solve, we are basically trying to avoid having to hand-code a lot of these function calls, and it's worked well for the case where you only have functions that take in one parameter which is what the design was originally for. The problems start when you try to support having variable number of arguments.
The only thing I have found so far is storing the parameters on the stack and invoking the function manually, something like this: C manually call function with stack and register But that solution seemed too messy. I was hoping for something more C++-like if possible.
Hopefully the question is at least clear enough.