Original Post
Hi, I've looked into templates before when I was still grasping the very basics of c++, and I thought at the time that templates were worthless and only used for data functions like sorting numbers and stuff. Basically I have a few linked lists that work fine but there's a lot of duplicate code for the linked list functions so I decided to look into generic programming and it was the only thing I found, so I thought I might as well look into it again and I thought that it might be possible to get what I want out of it.
So here's my attempt at making a template struct that is no doubt completely wrong(the format is almost identical to my other linked lists, except my other linked lists have a lot more data):
http://pastebin.com/SSGKmSWA
...
So, basically I want to know how/if I can use this template (my attempts to use it failed), or if there's some other method, just so that I don't have to write out the linked list functions for each list (particles, objects, entities, collision surfaces... it's a lot of repeat code with just changes in names). I'm okay with having to keep writing out all these list functions, but some kind of generic linked list template would be better. (For now I just put them all at the bottom of my "datastructures" header to increase the struct readability)
So here's my attempt at making a template struct that is no doubt completely wrong(the format is almost identical to my other linked lists, except my other linked lists have a lot more data):
http://pastebin.com/SSGKmSWA
...
So, basically I want to know how/if I can use this template (my attempts to use it failed), or if there's some other method, just so that I don't have to write out the linked list functions for each list (particles, objects, entities, collision surfaces... it's a lot of repeat code with just changes in names). I'm okay with having to keep writing out all these list functions, but some kind of generic linked list template would be better. (For now I just put them all at the bottom of my "datastructures" header to increase the struct readability)