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-必須把模板和類型名稱關鍵字 – 2011-12-20 01:18:01
現在爲一個愚蠢的後續問題:爲什麼不只是刪除最後一行?這不僅僅是多餘的第二次宣言嗎? – 2011-12-20 01:38:26
Doh!我現在明白了。未定義的參考。這是所需的*定義*,而早期的行只是*聲明*。 – 2011-12-20 01:40:09