template <class T, int n>
class mm
{
};
template<typename T, int c>
void ff(T tt,int cc)
{
}
void main()
{
mm<int ,5> mmm;
ff<int,2>(2,33);
system("pause");
}
对于非类型的,浮点数以及字符串的文字都不能使用
日如
template<char const*name>
class ccc{};
ccc<"dd"> c;//error
以及全局指针
char const *s = "dd";
ccc<s> c;//error ,全局指针也不能使用
不过可以
extern char const s[] = "hello";//外部链接对象
ccc<s> x;//这样可以