6
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’

Aaron McDaid
  • 25,518
  • 9
  • 58
  • 85
Martin
  • 8,659
  • 8
  • 50
  • 80

1 Answers1

9

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];
// ^^^^^^^^
Seth Carnegie
  • 72,057
  • 21
  • 174
  • 247