Is it possible to specialize a class template by aliasing? I want to specialize a class template S
for, say, double
. But it is exactly same with existing type X<double, A, B>
. So I want to use it succinctly.
template<class, class, class> X;
template<class, class> Y;
template<class> struct S;
template<> struct S<int> { ... }; // usual way to specialize
template<> using S<double> = X<double, A, B>; // what I want, but compile error.
template<> using S<float> = Y<C, D>; // what I want, but compile error.
I'd like to have something like the last line. Is there a way to achieve this?
This question is marked as a duplicate of
Best way (Or workaround) to specialize a template alias. But the accepted answer of the question cannot be applied if there are other type pairs. For example, if S<float>
sould be aliased with Y<C, D>
, the method provided by the accepted answer does not work. I think that other answers for the question also do not provide answer for my question.