नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
"name" : invalid friend template declaration
Remarks
It is invalid to declare a friend of a class template specialization. You cannot declare an explicit or partial specialization of a class template and in the same statement declare a friend of that specialization. The name placeholder identifies the invalid declaration.
To correct this error
Do not declare a friend of a class template specialization.
If appropriate for your application, declare a friend of the class template, or declare a friend of a particular partial or explicit specialization.
Example
The following code example fails because it declares a friend of a partial specialization of a class template.
// c3772.cpp
// compile with: /c
// A class template.
template<class T> class A {};
// A partial specialization of the class template.
template<class T> class A<T*> {};
// An explicit specialization.
template<> class A<char>;
class X {
// Invalid declaration of a friend of a partial specialization.
template<class T> friend class A<T*>; // C3772
// Instead, if it is appropriate for your application, declare a
// friend of the class template. Consequently, all specializations
// of the class template are friends:
// template<class T> friend class A;
// Or declare a friend of a particular partial specialization:
// friend class A<int*>;
// Or declare a friend of a particular explicit specialization:
// friend class A<char>;
};