C++ specialization of template function inside template class

后端 未结 6 754
暗喜
暗喜 2020-12-05 00:32

What is the C++ syntax for specializing a template function that\'s inside a template class? For example, consider that I have the following two classes and their usage. I

6条回答
  •  青春惊慌失措
    2020-12-05 00:44

    Try

    template <>
    template 
    int X::template getAThing(std::string param)
    {
       return getIntThing(param);
    }
    

    This still doesn't compile, but it's closer than you had.

    I think you can't specialize members en masse. You have to specify a particular specialization of the class template before you can start specializing its members.

提交回复
热议问题