quote:
The one reason to use the STL is that it is standardized. It is doubtful that someone could create a faster vector class that maintains exception-safe and exception-neutral criteria and is faster than the STL one.
I had created a calculations DLL for our product at work and I needed some kind of dynamic array/linked list so I used the STL vector class.
I ran into a problem when the time came to port it over to Windows CE. Turns out that Windows CE doesn''t support the STL.
So I wrote my own version of STL''s vector class, tested it, fixed the few bugs, ported it, and everything worked like a charm.
I ran a performance test on STL''s vector and my version, by adding 1 million integers one at a time, then removing all 1 million one at a time. The results were that they were perfectly even. Mine was 1 millisecond faster first run, then 1 millisecond slower, then perfectly even, etc, etc.
For curiosity sake, my push_back function is ~20% faster, but my pop_back is about ~20% slower. I have yet to go through and look for tweaks to speed it up.
quote:
I was just like you a while back. I didn''t like reusing libraries because I always wanted to be in control of the details. As I started working in a corporate environment I realized that due to time constraints or compatibility reasons
Absolutely agreed that if you have time constraints that you should use whatever libraries will help you get the job done. Mind you, in may case it actually slowed down production, but I don''t too many people will port their games to Windows CE
quote:
Why write a linked list for production[i/] code when one exists already?
If it''s for production and you have time constraints and you''ve NEVER EVER written a linked list before, then I agree, absolutely. But I''m sure that just about every one has written a linked list, whether on their own or in school. And once you''ve written one you should never, EVER have to write one again (except for those C programmers who can''t use templates).
So my question is, once you''ve written one, WHY would you ever need to use STL''s?
As for the other classes (vector, string, etc) I feel the same way. I feel I should know how to write a vector or string class, and once I do I never have to use another version again.
Maybe it has to do with the fact that I program to learn, rather than for the end product...
- Houdini