निम्नलिखित टेम्पलेट विशेषज्ञता कोड:सी ++ टेम्पलेट विशेषज्ञता: "स्पष्ट टेम्पलेट तर्क के अवैध उपयोग"
template<typename T1, typename T2>
void spec1()
{
}
टेस्ट मामले 1:
template< typename T1> //compile error
void spec1<int>()
{
}
टेस्ट मामले 2:
template< typename T2> //compile error
void spec1<int>()
{
}
निम्न संकलन त्रुटि उत्पन्न करता है:
error C2768: 'spec1' : illegal use of explicit template arguments
क्या किसी को पता है क्यों?
आप किस प्लेटफ़ॉर्म/कंपाइलर का उपयोग कर रहे हैं? – aaa90210
मैं विजुअल सी ++ 08 – jameszhao00