I have a templated class Matrix. I want to specialize a function for the type complex, where T can be anything. I have tried this :
6 template <typename T>
7 class Matrix {
8 public :
9 static void f();
10 };
11 template<typename T> void Matrix<T>::f() { cout << "generic" << endl; }
12 template<> void Matrix<double>::f() { cout << "double" << endl; }
13 template<typename T> void Matrix<std::complex<T> >::f() { cout << "complex" << endl; }
Line 13 does not compile. How can I do that ?