2
我学习的模板,我觉得这个例子:如何识别部分模板特化
template <typename T, int size>
void print(StaticArray<T, size> &array)
{
for (int count = 0; count < size; ++count)
std::cout << array[count] << ' ';
}
template <int size>
void print(StaticArray<char, size> &array)
{
for (int count = 0; count < size; ++count)
std::cout << array[count];
}
为什么第二print
功能工作,即使它是有non-type
参数size
,为什么它是完整的模板专业化。