Is the following construction possible ?:
template <typename T> class Test{ public: template <typename Z> void doSomething();
Now, if that were possible, I would do some explicit specializations for doSomething so that in the end I have some versions, as shown below:
void doSomething<int>(){
which seems impossible I can’t find any syntax for the job, then I thought that the design should be as it should, so that all the template arguments are passed to the template class itself:
template <typename T,typename Z> class Test{ public: void doSomething();
Then I tried a partial specialization that didn't even compile:
template <typename T> void Test<T,int>::doSomething(){
I get the following errors for explicit specialization:
error # 1: the list of template arguments following the class template name should contain a list of parameters that are used in the template parameter list. error # 2: "Container1": too few template arguments.
c ++ templates
Pooria
source share