Skip to main content
gamedev.net
🔒 Locked

Super..... duper?

Started by hlusnagen 4 replies 1.3k views
Original Post
hlusnagen
hlusnagen
Does anyone know of any linked-list class that is: super....................duper!! I need one that is very good and is simple to maintain. And i want it to support any kind of class.
Codespike
Codespike
yep STL RULESSS!

because it generalises what a linked list does, you just have to specify what you want it to store


easy as

#include [list] //yep no .h
#define list[int] MYLIST //replace [] with angled brackets
//it keeps on removing them for some reason

MYLIST mlst1;

int x;
mlist.push_back(x);
//now your homework is to research iterators so you can
// access the links in the list


Edited by - CodeSpike on November 29, 2001 1:03:17 AM

Edited by - CodeSpike on November 29, 2001 1:04:48 AM
Live by the code, die by the code
Oluseyi
Oluseyi
quote:
Original post by Codespike
#define list[int] MYLIST

I usually recommend typedefs instead. But I guess they''re equivalent...

quote:
//replace [] with angled brackets
//it keeps on removing them for some reason

Use & lt; and & gt; (without the spaces and with the semicolons):

#include <list>
typedef std::list<int> IntegerList;
IntegerList mylist;
...



Start Here!
hlusnagen
hlusnagen
Can i use my own class. And is thare a site whare i can get a working example or can someone show me one plese. :|:|:|:|:|:|:|:|:|:|:|:|

invective
invective
I would just use the STL, but if you are trying to learn how to write your own list, linked lists and other such things are usually taught in intro data structures classes and textbooks, so there are LOTS of examples available on the web, just do a search on google for data structures list code. Here is the first one I found (scroll down to LinkedList.cpp and LinkedList.h:

http://www.cs.fiu.edu/~weiss/dsaa_c++/Code/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.