I get what you are trying to do, but you are not doing it right. Try the following:
struct Base{}; struct Derived{}; // Original definition of Kind // Will yield an error if Kind is not used properly template<typename WhatToDo, typename T> struct Kind { }; // definition of Kind for Base selector template<typename T> struct Kind<Base, T> { typedef T type; }; // Here is the inheritance you wanted template<typename T> struct Kind<Derived, T> : Kind<Base, T> { }; // ... and the specialization for float template<> struct Kind<Derived, float> { typedef double type; };
source share