template <int N>
class myarray {
typedef int Bitmap;
public:
static Bitmap data[N];
};
template <int N> myarray<N>::Bitmap myarray<N>::data[N];
错误:之前的构造函数,析构函数或类型转换 “myArray的”
答案 0 :(得分:9)
typename
之前需要myarray<N>::Bitmap
,因为它是从属类型:
template <int N>
class myarray {
typedef int Bitmap;
public:
static Bitmap data[N];
};
template <int N>
typename myarray<N>::Bitmap myarray<N>::data[N];
// ^^^^^^^^