Computer Science Canada [source] Double-Linked List |
Author: | Catalyst [ Wed Oct 08, 2003 8:56 pm ] | ||
Post subject: | [source] Double-Linked List | ||
This a double linked list. Its the equivalent of std::list (speed-wise, std::list is about 8x faster in add elements, but they are equal in iteration speed) To compile these ull need to turn off compilation and linking for list.cpp or just rename it list.inl (that will turn those off automatically note: thers a bug in the iterator this code would go thru the entire list
|
Author: | wtd [ Wed Feb 11, 2004 1:32 am ] | ||||||
Post subject: | |||||||
A few things I would change:
Can't find anything else at the moment, but I'll let you know if I do. |
Author: | Catalyst [ Wed Feb 11, 2004 6:59 am ] |
Post subject: | |
Thanks for the tips They're very helpful But a few things
|
Author: | wtd [ Wed Feb 11, 2004 5:23 pm ] | ||
Post subject: | |||
Catalyst wrote: As for the naming scheme the inner-classes were originally outside the main class declaration (and this was part of a larger project) so i felt that i should have named them that. I guess i got lazy afterward when i moved them into the class
Refactoring code sucks, doesn't it? Catalyst wrote: At the point this was written i had never heard of inherited classes being referred as subclasses, and i thought the term fit here
Yeah, it's a fairly common way to refer to "child classes". Speaking of inheritance, you might save yourself a lot of work by inheriting from the std::list class and simply adding the features you want.
Catalyst wrote: for the templates i didnt like the idea of having all the code in the header so i moved it to a .cpp and turned off complilation and linking on the file (saving as .inl would probably be better tho)
Like it or not, that's where it all belongs. Only things that can be compiled should go into a *.cpp file. Declarations of things (including templates) belong in a header file. |
Author: | Catalyst [ Wed Feb 11, 2004 5:57 pm ] |
Post subject: | |
i intentionally reinvented the wheel this time I thought it would be a good experience making some basic container classes |
Author: | wtd [ Wed Feb 11, 2004 8:16 pm ] |
Post subject: | |
Catalyst wrote: i intentionally reinvented the wheel this time
I thought it would be a good experience making some basic container classes It is, but now learn how to work with the STL. |
Author: | Catalyst [ Wed Feb 11, 2004 8:51 pm ] |
Post subject: | |
already do |