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’このテンプレート定義で何が問題になっていますか?
関連:http://stackoverflow.com/questions/610245/where-and-why-do-i-テンプレートと型名のキーワードを持たなければならない –
今、愚かなフォローアップの質問のために:最後の行を削除しないのはなぜですか?それは冗長な2番目の宣言ではありませんか? –
Doh!私は今参照してください。未定義の参照。これは必須の定義*ですが、前の行は*宣言*です。 –