Keeping a reference to a linked list element

BLM768 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 11 14:21:33 PDT 2016


I just started working on a project in which it would be 
convenient to hold a reference to a specific entry in a DList. 
The interface doesn't seem to provide a way to get a pointer to a 
raw node struct, so about the best solution I can find is to get 
a range out of the list, pop elements until I get to the one I 
want to store, and save a reference to the front of the range 
with theRange.takeOne. I could then remove that node with 
theList.remove(theSavedNode), insert before/after it, etc., but I 
can't see a good way to just _get_ the node before or after it. 
Is there a good way to do this with the current interface, or 
would it need to be extended?


More information about the Digitalmars-d-learn mailing list