How should I move in a DList ?

Gabriel noadress at noadress.noadress
Wed May 13 09:57:30 UTC 2020


Hello,

As I am totally new to D (my background is mainly C++) I am 
having trouble porting an algorithm that simplifies a polyline in 
2D, very similar to this one: 
http://psimpl.sourceforge.net/reumann-witkam.html

Here is what I would like:
1) Use a doubly-linked list, preferably one from a standard 
library (I need fast insertion/removal anywhere inside the list).
2) Have multiple "cursors" (ref to a list node, pointers, 
iterators etc.) that I move forward in my list when needed.
3) Remove and add some elements in the list (at/between "cursor" 
positions).

I am fine with having "unsafe" code for this example (the 
function is 43 lines long in C++, does not have too many cases 
and would be tested on a lot of data).

What "cursor" should I use to get something similar to C++'s 
std::list's iterators, or C#'s LinkedListNode that I was able to 
use to port the algorithm in C++ and C# ? (I am benching 
languages).

Thanks in advance,



More information about the Digitalmars-d-learn mailing list