Originally Posted by
robolee
hurr, you really are stupid, doing "it" in the first quote relates to turning my code into a template, doing "it" in the second quote relates to making a working linked list and making it as efficient as possible (i.e elimate a lot of code re-writing), if somebody turns it into a template then I will still have done more than 80% of the work so I would have achieved my aim and done "it", nowhere in the second quote does it say "on my own".
It's tempting to let you flounder. But I really fail to see the difficulty to turn this:
Code:
typedef struct Object{//an "object" of the list
Object *Next;
Object *Previous;
void Add();
void Remove(Object *n);
void CleanList();
} Object;
into this:
Code:
template <typename T>
typedef struct Object{//an "object" of the list
Object<T> *Next;
Object<T> *Previous;
void Add();
void Remove(Object<T> *n);
void CleanList();
T actual_data;
} Object;
which is what is required. If thirty seconds of reading a template tutorial can't get you to here, I don't know how much help anyone can be.
(This assumes that your original works correctly. If it doesn't, you would need to fix this in the same way. For instance, it seems unlikely that you want Add() to be a void function that takes no arguments, but if you have it working then great.)