I want to specialize a template class using a nested name specifier of another template class. But the compiler complains that it can't deduce this code. What should I do?
template <typename T>
struct convert{ // this is a class in an extern library
// the guide of this library tells me to specialize
// convert to my own class for some features.
void foo(T&t) {/* do something */}
};
template <typename T>
struct A{
struct A_sub{ // my class
};
};
template <typename T>
struct convert<A<T>::A_sub> { // error, compiler can't deduce
};
error: class template partial specialization contains a template parameter that cannot be deduced; this partial specialization will never be used [-Wunusable-partial-specialization]
struct convert::A_sub> {
main.cpp:65:19: note: non-deducible template parameter 'T'
template
1 error generated.