D
desktop
I have stumbled upon different ways to declare a function template
specialization.
Are the following examples synonymous or are there significant differences:
template<typename T> // Primary function template
void myTemp(T) {
}
template<> // int version with arg 'a'
void myTemp(int a) {
// do something with a
}
template<> // int type only version
void myTemp(int) {
}
template<> // int int type version
void myTemp<int>(int) {
}
specialization.
Are the following examples synonymous or are there significant differences:
template<typename T> // Primary function template
void myTemp(T) {
}
template<> // int version with arg 'a'
void myTemp(int a) {
// do something with a
}
template<> // int type only version
void myTemp(int) {
}
template<> // int int type version
void myTemp<int>(int) {
}