I have a function A that takes two arguments => a callback function and an argument for a callback function. The callback argument can be constructed in an int type or a user type. How can I declare function A?
eg:
void functionA(void (*handler)(TYPEA), TYPEA variableA)
{
*handler(variableA);
}
TYPEA can be a built-in type or a user-defined type. Should I use dynamic_casting in the handler to cast type A to the appropriate type based on the callback function (in this case, what should typeA be?) Or use a template in this case?
source
share