Specialization of templated member function in templated class

Yes, this is the problem:

error: enclosing class templates are not explicitly specialized 

You cannot specialize a member without also specializing the class.

What you can do is put the code from function in a separate class and specialize that, much like basic_string depends on a separate char_traits class. Then then non-specialized function can call a helper in the traits class.

Leave a Comment