我有一个模板化的类A< T,int>和两个typedef A< string,20>和A< string,30>.
如何覆盖A< string,20>的构造函数? ?以下不起作用:
如何覆盖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)?