C++ specialization of template function inside template class

后端 未结 6 745
暗喜
暗喜 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:48

    AFAIK (and the standards experts can correct me), you cannot specialize a templated function of a class template without specializing the class itself...

    i.e. the following I think will work:

    template <> template <> int X::getAThing(std::string param) {
       return getIntThing(param); // Some function that crunches on param and returns an int.
    }
    

提交回复
热议问题