#include <iostream>
using namespace std;
template<typename T> void test()
{
cout << "Called from template T";
}
template<int I> void test()
{
cout << "Called from int";
}
int main()
{
test<int()>();
}
Run Code Online (Sandbox Code Playgroud)
在上面的代码片段中test<int()>()调用第一个版本并提供输出
Called from template T
为什么不调用第二个版本?