如下一个程序:
// tplate.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
template <int a> void Render(void)
{
printf("%d /n",a);
}
int main(int argc, char* argv[])
{
printf("Hello World!/n");
Render<1>(); //想让Render打出1
Render<2>(); //想让Render打出2
Render<3>(); //想让Render打出3
return 0;
}
可vc6编译出来的结果是三个Render都打印出了3,而用.net编译出来的就是正确的。
难道是vc6不支持这样的函数模板吗?可为什么连个警告都没有?还是要包含什么
头文件或者有什么编译选项没打开。
请各位指教。