S
shuisheng
Dear All,
Assume I have a class template:
template<class T, int N = 0>
class A
{
void fun1();
void fun2();
void fun3();
void fun4();
void NRelatedFun(); // related to template parameter N.
};
Here fun1(), fun2(), fun3(), fun4() are the same. NRelatedFun() are
related to N. How to code the particular functions? I think class
template can be partial specialized. So I write as
template<class T, 1>
void A<T,1>::NRelatedFun();
But the compilor give some errors. I tried several other ways, but
still failed.
I appreicate your kind help.
Shuisheng
Assume I have a class template:
template<class T, int N = 0>
class A
{
void fun1();
void fun2();
void fun3();
void fun4();
void NRelatedFun(); // related to template parameter N.
};
Here fun1(), fun2(), fun3(), fun4() are the same. NRelatedFun() are
related to N. How to code the particular functions? I think class
template can be partial specialized. So I write as
template<class T, 1>
void A<T,1>::NRelatedFun();
But the compilor give some errors. I tried several other ways, but
still failed.
I appreicate your kind help.
Shuisheng