How can set different function signature to the same function pointer?
问题 This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 4 years ago . How can I set a function pointer depending on some condition 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 functions with different signature? Is it possible? If is not,