共用方式為


編譯器錯誤 C2701

'function': 函式範本不能是 friend 本機類別的

備註

本機類別不能有函式範本做為函 friend 式。

範例

下列範例會產生 C2701:

// C2701.cpp
// compile with: /c
template<typename T>   // OK
void f1(const T &);

void MyFunction() {
   class MyClass {
      template<typename T> friend void f2(const T &);   // C2701
   };
}