Reputation: 9369
template <int N>
class myarray {
typedef int Bitmap;
public:
static Bitmap data[N];
};
template <int N> myarray<N>::Bitmap myarray<N>::data[N];
error: expected constructor, destructor, or type conversion before ‘myarray’
Upvotes: 6
Views: 101
Reputation: 75130
You need typename
before myarray<N>::Bitmap
because it is a dependent type:
template <int N>
class myarray {
typedef int Bitmap;
public:
static Bitmap data[N];
};
template <int N>
typename myarray<N>::Bitmap myarray<N>::data[N];
// ^^^^^^^^
Upvotes: 9