I am facing a problem implementing a templated struct in another templated struct.
Basically this works:
template<typename T>
struct ListElement {
T Value;
struct ListElement<T>* Next;
};
template<typename M>
struct List {
struct ListElement<M>* ContainedElements;
};
But what I really want is an implementation like that:
template<typename T>
struct ListElement {
T Value;
struct ListElement<T>* Next;
};
template<typename M>
typedef struct ListElement<M>* List;
The thing is that you can not use typedef with templates. Any workaroud to write struct List<Anytype>
instead of struct ListElementPointer*?
PS: It is a school project by the way. Using standard vector or list classes is not allowed and I do not want to type new definitions for every type I use...classes are not allowed as well :-/