6
struct Messages
{
template <typename V>
static const char* message() {return "test mesage";}
};
template <int Min, class M=Messages>
struct Test: public M
{
Test()
{
M::message<int>(); //error: expected primary-expression before 'int'
}
};
int main()
{
Test<5, Messages> t;
}
衍生我懷疑這跟一些相互依存,就像測試的代碼取決於基M級,其方法是內部專業模板類的模板方法測試。它是否正確?爲什麼我不能調用從
謝謝,就是這樣。我不知道使用'template'關鍵字來消除依賴名稱的歧義。 – 2012-03-14 15:54:06