is there a way to pass a function to another function where this passed function would be called inside the second function with the parameters given while passing it. However, the function passed can have different parameters.
I do not want to run the function with data from inside the calling function, just the parameters i passed when calling the function that does the actual call. Basically a periodic check to see if it's ok to continue.
An example of what i'm trying to do:
bool CheckSomething1 (int a, int b) { /* some code */ }
bool CheckSomething2 (int a, int b, int c) { /* some code */ }
bool WaitForTrue ( something funct something.. )
{
while (! funct) {
/* do some work */
}
}
int _tmain(int argc, _TCHAR* argv[])
{
WaitForTrue(CheckSomething1(1, 2));
WaitForTrue(CheckSomething2(1, 2, 3));
return 0;
}
Edit: Basically i'm looking for a way to pass a function with a different number of parameters that can be different types to another function and run it, but the parameters called can be different each time when passing them, but stay the same while in the function to which it is passed.