टेम्पलेट कटौती गलत लग रहा था, क्यों (सी) (बी) के बजाय कहा जाता है?टेम्पलेट कटौती गलत लगता है
#include <iostream>
using namespace std;
template<class T> void f(T){cout << "f(T)";}//(a)
template<> void f<>(int*){cout << "f(int*)";}//(b)
template<class T> void f(T*){cout << "f(T*)";}//(c)
//void f(int*){cout <<"POD:f(int*)";}//(d)
int main(int argc,char*argv[])
{
int p = 1;
f(&p);
cout <<endl;
return 0;
}
उत्पादन:
f(T*)
सी [क्यों समारोह टेम्पलेट्स विशेषज्ञ नहीं] (http://www.gotw.ca/publications/mill17.htm)। – juanchopanza
@jogojapan मैंने प्रश्न को बेहतर ढंग से प्रतिबिंबित करने के लिए डुप्लिकेट का शीर्षक बदल दिया। – juanchopanza