テンプレート化されたクラス A<T, int> と 2 つの typedef A<string, 20> と A<string, 30> があります。A<string, 20> のコンストラクターをオーバーライドするにはどうすればよいですか? 以下は機能しません。
template <typename T, int M> class A;
typedef A<std::string, 20> one_type;
typedef A<std::string, 30> second_type;
template <typename T, int M>
class A {
public:
A(int m) {test= (m>M);}
bool test;
};
template<>
one_type::one_type() { cerr << "One type" << endl;}
クラス A<std::string,20> に、他のクラスではできないことをさせたいと思います。コンストラクター A:A(int) を変更せずにこれを行うにはどうすればよいですか?