共用方式為


編譯器錯誤 C3412

'template' : 無法將範本特製化為目前範圍

範本不能在類別範圍中特製化,只能在全域或命名空間範圍中。

範例

下列範例會產生 C3412。

// C3412.cpp
template <class T>
struct S {
   template <>
   struct S<int> {};   // C3412 in a class
};

下列範例顯示可能的解決方案。

// C3412b.cpp
// compile with: /c
template <class T>
struct S {};

template <>
struct S<int> {};