PeteJM01

I have been looking all over the web for a good example of Doubly Linked Lists, so that I can use one for a program I am working on at the moment.

I would have used a vector, but because I am building a windows forms app the compiler doesnt like me trying to mix STL stuff into my app.

Does anyone know of any really good tutorials or examples, that include functions for adding nodes to front, end and anywhere inbetween, as well as other standard functions like deletion and finding values by using a search or looking at a value at a particular location by its place in the chain

Thanks.




Re: Visual C++ Language Doubly Linked Lists

Simple Samples

It is much more productive to solve the problem of use of the STL. I am not familiar with Windows forms but I doubt that they are incompatible with the STL.






Re: Visual C++ Language Doubly Linked Lists

Marius Bancila

If you don't want STL, take a look at the array generic type and the other collections from the System::Collections and System::Collections::Generic namespaces.




Re: Visual C++ Language Doubly Linked Lists

PeteJM01

Well I took a look at the Systems::Collections and ::Generic, I tried to use the LinkedList object, but I hit an error... :(

LinkedList<Spell> spellbook;

Firstly unlike other STLs like vectors this LinkedList did not like my Spell structure, and to top that it is not being accepted because the object that I am using to hold this varaible is native, so it can't use any of the system namespace stuff, and I cant use STL because it does not seem to work with my windows forms stuff.

Any ideas how I can get around this or another method...






Re: Visual C++ Language Doubly Linked Lists

einaros

PeteJM01 wrote:

LinkedList<Spell> spellbook;

Firstly unlike other STLs like vectors this LinkedList did not like my Spell structure, and to top that it is not being accepted because the object that I am using to hold this varaible is native, so it can't use any of the system namespace stuff,

Not without making it a reference class.

PeteJM01 wrote:

and I cant use STL because it does not seem to work with my windows forms stuff.

What happened when you tried using the STL Can you show us the errors and related source code






Re: Visual C++ Language Doubly Linked Lists

PeteJM01

When I try using ref to make a reference class it seems to create huge numbers of errors that I don't have a clue why they are happening, so I have avoided using ref for that reason.

I tried out the vector again, and it seems to be working now, I don't have a clue why it wasn't before :/.

typedef std::vector<Spell> Spellbook;

Anyway thanks for the help, if I have anymore trouble with this then I will bring it up again...






Re: Visual C++ Language Doubly Linked Lists

Simple Samples

PeteJM01 wrote:
I tried out the vector again
I think that is what I suggested originally.