// This is all just test code
// ZE templates
template <typename T>
struct Info {
static void Print();
};
template <typename T>
struct Info<MyTemplate<T>> {
static void Print();
};
template <typename T>
void Info<T>::Print() {
std::cout << typeid( T ).name() << std::endl;
}
template <typename T>
void Info<MyTemplate<T>>::Print() {
std::cout << typeid(T).name() << std::endl;
std::cout << typeid( MyTemplate<T> ).name() << std::endl;
}
// ZE usage
Info<int>::Print();
// Output:
// int
Info<MyTemplate<int>>::Print();
// Output:
// int
// class MyTemplate<int>
Info<MyTemplate<int*>*>::Print();
// Output: class MyTemplate<int*>*
I needed to get that pointer reference for MyTemplate<int>* and the non pointer reference for MyTemplate<int> as well to manage this stuff and amazingly enough:
template <typename T> void Info< MyTemplate<T> >
Gives me a MyTemplate<T>* when MyTemplate<T>* is asked for, when I use MyTemplate<T> in the template code. Sort of hard to understand that since it's a bit of a linguistic mess, but I'm pretty sure you guys get the point. It seems the T of the template argument is lost in the second case, and I don't know why that is either. Full disclosure; I am running on the belief that this is functioning by typeid working, as of yet I haven't tested whether or not the lack of the T in the second MyTemplate means that the MyTemplate<T>* is unusable.
Only just realised after posting that the MyTemplate<int>* case is not being handled by the partially specialized function. So it's not working, mod delete.
basically the end result is that there will have to be two partial specializations for pointer & non pointer type.