[Edited] Based on the feedback from comments, I have rephrased my question.
In C++, is it possible to create a function func
that receives another function f
as a parameter, if the number of arguments of f
might change?
According to this thread, a syntax in C like
void func ( void (*f)(int) );
would help if I already know the number of arguments f
receives, but that's not my case.
I want to use func
with different functions f1
, f2
, etc., each of them may or may not have the same number of parameters. For example, f1
could take only one argument, but f2
could take two. That's why I'm trying to look for a way to pass f
without specifying the number of arguments. Thanks!