[solved]C++ template for generic linked list

Started by
10 comments, last by Zakwayda 14 years, 10 months ago
By all means, try and write your own linked list for learning purposes. Just don't let that be "instead of" learning how to use std::list etc, or you'll keep finding an excuse to not use something that really is very well done, very powerful and very easy to use if you only investigate it.
If you've got the time to make your own then there's obviously plenty of time to do both, and doing both at the same time would probably even save you time.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Advertisement
Quote:Original post by argonaut
If you intend to get into programming as a profession, especially in games, you will find that STL is not allowed (or, more correctly, has been reimplemented).
I don't think that's true in the general case. Some game studios avoid using the STL-based portions of the SC++L entirely; some create their own implementations or implement custom container classes; some use the SC++L containers with custom allocators; and some use the SC++L containers as is. I could be wrong about this I suppose, but I'm pretty sure that to say that, in general, using SC++L containers in professional game development is 'not allowed', is incorrect.
Quote:Original post by polarboy
1) This is my first time using templates
Good reason.
Quote:2) I had bad experiences stuff other people wrote, and took me a long long time looking for documentation and error codes, so I'd prefer to write my own thing and know exactly what's going on rather than relying on what other people has done.
Bad reason (IMO).

The SC++L isn't a third-party library - it's part of the language. It's well documented online and elsewhere, so you shouldn't have any trouble finding the information that you need.

As for 'relying on what other people have done', this is a case where you absolutely should rely on what other people have done. Assuming you're using a widely-used implementation of the SC++L, the code is practically guaranteed to be reliable and to be maximally efficient given the specifications.
Quote:Besides, I get a lot of flexibility this way, right now, I don't know what special feature I want to add, but I'm anticipating for some, in which case, i can inherit the class and do whatever I want to it.
Don't forget YAGNI. Also, it's often better to implement 'special features' not through inheritance, but rather via wrappers around standard containers, or as non-member functions that operate on standard containers.

This topic is closed to new replies.

Advertisement