问题遇到的现象和发生背景
在写头文件时,发现需要像下面那样去定义函数指针,感觉很繁琐。
问题相关代码,请勿粘贴截图
typedef int (*ptr0)();
typedef int (*ptr1)(int);
typedef int (*ptr2)(int,int);
typedef int (*ptr3)(int,int,int);
ptr0 p0;
ptr1 p1;
ptr2 p2;
ptr3 p3
我想要达到的结果
经过处理后,函数指针可以无视指向的函数传入参数的类型与数量,可以赋值并访问。
尽量可以在一处处理,全局有效