"Carl Daniel [VC++ MVP]" wrote:
Specialization `struct Y<X<int>, T2, T3>' is rejected. If I
specialize with concrete X<N> (for example, `struct Y<X<42>,
T2, T3>'), then everything compiles and runs properly.
However, I cannot predict the value of N, of course.
Is there any workaround?
Rethink your design. X<int> isn't a class, X<5> and X<3> are classes.
It sounds like you're trying to use a compile-time feature (template
specialization) to deal with a runtime issue (a value not known at
compile time).
The problem is that I cannot change X. Due to peculiarities of X the
implementation of Y is less efficient and unclear. Y still works for other
types, however I don't like the fact that other types need to pay high
price for misbehaviours of X. So, I hoped to provide clear and concise
version of Y for all, while making custom version for X exclusively.
I can make `struct Y<T1*, T2, T3>' specialization where T1 is unknown
until instantiation. Why can't I make X<int> specialization?
has no meaning at all).