नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'attribute': attribute is not allowed on template definitions
Remarks
Attributes cannot be applied to template definitions.
Example
The following example generates C3408.
// C3408.cpp
// compile with: /c
template <class T> struct PTS {
enum {
IsPointer = 0,
IsPointerToDataMember = 0
};
};
template <class T>
[coclass] // C3408
struct PTS<T*> {
enum {
IsPointer = 1,
IsPointerToDataMember = 0
};
};
template
<class T, class U>
struct PTS<T U::*> {
enum {
IsPointer = 1,
IsPointerToDataMember = 1
};
};
struct S{};
extern "C" int printf(const char*,...);
int main() {
S s, *pS;
int S::*ptm;
printf("PTS<S>::IsPointer == %d PTS<S>::IsPointerToDataMember == %d\n", PTS<S>::IsPointer, PTS<S>:: IsPointerToDataMember);
printf("PTS<S*>::IsPointer == %d PTS<S*>::IsPointerToDataMember == %d\n", PTS<S*>::IsPointer, PTS<S*>:: IsPointerToDataMember);
printf("PTS<int S::*>::IsPointer == %d PTS<int S::*>::IsPointerToDataMember == %d\n", PTS<int S::*>::IsPointer, PTS<int S::*>:: IsPointerToDataMember);
}