I have a class template for which I want to introduce several template specializations. Those template specializations identical to some existing type. Conceptually I would
Assuming only certain specialisations of Common are aliases of TypeZ then you can do:
template class Common {
struct type {
/// general implementation
};
};
template<> class Common { using type = TypeZ; };
template<> class Common { using type = TypeZ; };
template<> class Common { using type = TypeZ; };
template using common_t = typename Common::type;
Then you use common_t rather than Common.
Just to entertain the inheritance idea, have you tried this?
template<> class Common : public TypeZ { using TypeZ::TypeZ; };
template<> class Common : public TypeZ { using TypeZ::TypeZ; };
template<> class Common : public TypeZ { using TypeZ::TypeZ; };
Then you don't need to use a nested type alias.