I want to create a function like thread() function (get N parameters). I think I have to use a template like this:
template <typename Func, typename Param1, ...>
void function(params)
{
}
But for my function, I have to set a limited number of parameters. In the thread() function you can give this function N parameters. How is it possible to create a function and give the parameters same inside function params?
template <typename Func, typename Param1, typename Param2, typename Param3 = typename()>
void Remote_function_caller(Func Function_name, Param1 P1, Param2 P2, Param3 P3 = Param3())
{
Function_name(P1, P2, P3);
}
void Tool1(int Data1, int Data2)
{
}
void Tool2(int Data1, int Data2, int Data3)
{
}
void main()
{
// Call tool 1
Remote_function_caller(Tool1, 5, 6);
// Call tool 2
Remote_function_caller(Tool2, 5, 6, 9);
}
To call Tool1 I have to enter 2 parameters but system gives an error because caller needs 3 parameters (and load that function with 3 parameters)...
Aucun commentaire:
Enregistrer un commentaire