由买买提看人间百态

topics

全部话题 - 话题: funcany
(共0页)
a****s
发帖数: 524
1
I thought it for a while because it looks interesting.
Although I didn't work through to the final solution, I am pretty sure this
can be solved in compile time by using templates
The idea is creating template functions for all possible number of arguments
a function can have, the limit I believe is 256.
For exmaple: assuming all functions return void.
typedef void(MyClass::*funcany)(...);
int count ( (void (MyClass::*func0)()) fp)
{
if (!static_cast(fp))
return -1;
return ... 阅读全帖
(共0页)