Template specialization of a single method from templated class with multiple template parameters

前端 未结 2 1694
天涯浪人
天涯浪人 2020-12-21 08:43

I\'m basically trying to do what was discussed in Template specialization of a single method from a templated class except that my TClass has multiple template Parameters li

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-21 09:32

    You have to specialize the entire class before you define a method through a partial specialization:

    template 
    class TClass;
    
    template 
    class TClass
    {
        void doSomething(int* v);
    };
    
    template 
    void TClass::doSomething(int* v)
    {
        // ...
    }
    

    Live demo

提交回复
热议问题