为什么我总是可以在 typedef 中添加一对括号,这是什么意思?
#include <iostream>
#include <typeinfo>
int main() {
typedef int td;
std::cout << typeid(td).name() << std::endl;
std::cout << typeid(td()).name() << std::endl;
return 0;
}
输出:
i
FivE
最佳答案
td()
是 int()
:一个返回 int
且不带参数的函数。
关于带括号的 C++ 非函数 typedef,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26282474/