I want to partially specialize a class for a class nested inside a template class, like this
template <typename T, typename U = void>
struct base {
void print() {
std::cout << "base specialization" << std::endl;
}
};
template <typename A, typename B>
struct Outer {
struct Inner {
A a;
B b;
};
};
// What I am trying to achieve
template< params... >
struct base < specialization ... > {
void print() {
std::cout << "Outer::Inner specialization" << std::endl;
}
};
such that its true for all A, B combination of typenames
I would like to achieve
base<Outer<int::char>::Inner>().print();
base<Outer<char::char>::Inner>().print();
base<Outer<int::float>::Inner>().print();
print Outer::Inner specialization
New contributor
SWARUP SENGUPTA is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1