T的类型是什么?

big*_*g-z 5 c++ templates

在下面的代码中:

template<typename T>
struct X {};

int main()
{
  X<int()> x; // what is the type of T ?
}
Run Code Online (Sandbox Code Playgroud)

T的类型是什么?我在boost消息来源中看到了类似的东西.

Kir*_*sky 12

考虑这个功能int func().它有一个功能类型int(void).它可以隐式转换为指针类型,如C++标准在4.3/1中所述,但在这种情况下,不需要这样的转换,T函数类型也是如此int(void),而不是指向它的指针.