D
Dave Theese
Hello all,
The code shown below is adapted from Mr. Sutter's Guru of the Week #49.
The 8'th definition of f() is a specialization. What is it a specialization
of (i.e., which is the primary template)???
Is there an answer? If so, is it moot or is the answer meaningful in some
functional way?
Thanks,
Dave
template<class T1, class T2> int f(T1, T2) {return 1;}
template<class T> int f(T) {return 2;}
template<class T> int f(T, T) {return 3;}
template<class T> int f(T*) {return 4;}
template<class T> int f(T*, T) {return 5;}
template<class T> int f(T, T*) {return 6;}
template<class T> int f(int, T*) {return 7;}
template<> int f<int>(int) {return 8;}
int f(int, double) {return 9;}
int f(int) {return 10;}
The code shown below is adapted from Mr. Sutter's Guru of the Week #49.
The 8'th definition of f() is a specialization. What is it a specialization
of (i.e., which is the primary template)???
Is there an answer? If so, is it moot or is the answer meaningful in some
functional way?
Thanks,
Dave
template<class T1, class T2> int f(T1, T2) {return 1;}
template<class T> int f(T) {return 2;}
template<class T> int f(T, T) {return 3;}
template<class T> int f(T*) {return 4;}
template<class T> int f(T*, T) {return 5;}
template<class T> int f(T, T*) {return 6;}
template<class T> int f(int, T*) {return 7;}
template<> int f<int>(int) {return 8;}
int f(int, double) {return 9;}
int f(int) {return 10;}