I want to write the following:
template <typename S, typename T> void foo() {
/* code for the general case */
}
template <typename T> void foo<MySType,T>() {
/* partially specialized code - for any kind of T, but when S is MySType */
}
or, in other cases, the following:
template <typename S, typename T> void bar(const S& a, const T& b) {
/* code for the general case */
}
template <typename T> void bar<MySType,T>(const MySType& a, const T& b) {
/* partially specialized code - for any kind of T, but when S is MySType */
}
C++(11) won't let me do this.
Now, I read this question and its answers; let's assume I buy the explanation of why we don't have partial template specialization (or just assume that that I'm living in reality and actually want to write code). Well, what do I do, in stead?
I would really rather not wrap these functions in a class unless that's absolutely my last resort.