我需要你的幫助再次......無模板中使用的參數錯誤
我有下面的代碼,這是造成明確的專業化非命名空間範圍錯誤:
namespace __test
{
template <int A, int B, typename C> class Test
{
template <int V> void check(C & a) { }
template <> void check<0>(C & a) { } //error: explicit specialization in non-namespace scope 'class __test::Test<A, B, C>'
};
}
因爲我已經知道如何解決這種錯誤,我定義專業化類範圍之外,但是我得到了另一個錯誤 - ......沒有模板參數使用:
namespace __test
{
template <> void Test::check<0>(C & a) { } //error: 'template<int A, int B, class C> class __test::Test' used without template parameters
}
我可能只是愚蠢,但我不明白這個問題的原因,我不知道如何解決它...請幫助!
'__test'在用戶編寫的代碼中是非法的。 – 2011-05-10 13:08:02
謝謝,這只是當我簡化有問題的代碼時想到的第一件事 – Ryan 2011-05-10 13:29:20
從什麼遷移? – jalf 2011-05-10 13:33:56