Relative Content

Tag Archive for c++templatesc++17template-specialization

Is there a way to pass a template type to a grand-child class without making a child template in C++?

I have a rather complex set of C++ object dependencies and I’m using templates to manage object specialization. I find templates confusing but they avoid a lot of problems with object casting that I really like. I now find myself needing to convert a class into a template simply so that I can pass the passed template type to a subclass – the class receiving the template specialization doesn’t care about the template type because it operates on the type’s base class. This class has a lot of logic that I don’t want to specialize and I’m trying to find a way to avoid that.