I wrote a class for this over a year ago. It's slow and kludgy, but it worked. I made it doubly linked (head and tail and each node has a previous and next link). I wrote an LLNode class that has
Private mNext as Object
Private mExt as Extent 'I'm keeping a list of extents
Private mPrev as Object
The linked list class has
Private mCount as Long
Private Head as LLNode
Private Tail as LLNode
I'm sure I could rewrite it faster and cleaner. It's the same logic as writing in in C, but no pointers, or rather ALL pointers. I'm sure you could use AddressOf to make your own pointers to address locations to speed it up.
You're welcome to a copy of the class if you want it.
scarfhead
The critical difference between a linked list in C/C++ and VB, is that in the C versions, you're storing a memory address of the other node(s). In VB, you'll be storing a object reference to the other node(s).
So you'd declare a class module called LLNode that contained member variables for your payload (the data needed by your program), as well as member variable(s) of type LLNode to point to the next node or nodes.
It's perfectly OK to have self-referential types in this case (a member variable of the same type as the surrounding class), as the VB runtime will have no problem resolving the class type.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.