【发布时间】:2013-07-11 18:15:04
【问题描述】:
我有以下模板类:
template <unsigned N>
class XArray {
static const int Xdata[N];
};
我想为我使用的每个XArray<N> 初始化静态常量数组,例如让XArray<N>::Xdata = {1, 2, 3, ..., N}。如何制作?
【问题讨论】:
-
这个link 应该有帮助
-
看来
array是一个不错的解决方案,谢谢
标签: c++ arrays templates static initialization