【发布时间】:2011-12-06 05:36:46
【问题描述】:
可能重复:
Can someone explain this template code that gives me the size of an array?
template <typename T,unsigned S>
unsigned ArraySize(const T (&v)[S])
{
return S;
}
我了解T 和S,但我的问题是为什么我们必须 将v 声明为引用变量?或者我可能误解了这整件事。
感谢您的帮助!
【问题讨论】:
-
糟糕,很抱歉。我真的不知道使用什么关键字来搜索我的问题。