I have a class
template <typename T>
class C
{
static const int K=1;
static ostream& print(ostream& os, const T& t) { return os << t;}
};
I would like to specialize C for int.
//specialization for int
template <>
C<int>{
static const int K=2;
}
I want the default print method that works for int to remain and just change the constant. For some specializations, I want to keep K=1 and change the print method because there is no << operator.
How do I do this?