テンプレート化されたクラスMatrixがあります。複合型の関数を特殊化したいのですが、Tは何でもかまいません。私はこれを試しました:
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; }
13行目はコンパイルされません。どうやってやるの ?