How can I set a function pointer depending on some condiction to functions with different signature?
example
short int A()
{
return 0;
}
long int B()
{
return 0;
}
void main()
{
std::function<short int()> f = A;
f();
if(true)
{
//error
f = B;
}
}
How can use the same function pointer for two function with different signature? is it possible?
If is not, there is an efficient way to call the appropriate function depending on behavior instead of use a variable and split the whole code with if statements?
thanks.
Aucun commentaire:
Enregistrer un commentaire