A Bite of Template in C++ (3)
5 Jul 2018 Languages C/C++metaprogramminginheritanceIn the post A Bite of Template in C++ (1), I mentioned a constraint for template member functions in class that explicit specialization is not allowed. However, I realized there are more constraints on function templates later when I wanted to make two template varients with slightly difference on only one member function. I tried specializing member function template, as well as inheriting a template member function from base class. Both of them failed due to some constraints. Briefly, the constraints are
- partial specialization is not allowed for function template,
usingdeclaration plustemplatedisambiguator is not the right way to inherit a template member function from a template class.
