Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 May 2019 at 22:20:48 UTC, Josh wrote: Thank you, that helps big time. This is just more curiosity, but do you happen to know why I have to use DList.linearRemove() instead of DList.remove()? import std.stdio; import std.container.dlist; import std.algorithm; import std.range;

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Boris-Barboris via Digitalmars-d-learn
On Sunday, 19 May 2019 at 22:20:48 UTC, Josh wrote: This is just more curiosity, but do you happen to know why I have to use DList.linearRemove() instead of DList.remove()? These two functions are separate because they differ in complexity. remove is O(1), linearRemove on the other hand

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Josh via Digitalmars-d-learn
Thank you, that helps big time. This is just more curiosity, but do you happen to know why I have to use DList.linearRemove() instead of DList.remove()? import std.stdio; import std.container.dlist; import std.algorithm; import std.range; void main() { auto list = make!DList("the",

Re: Linked List iterating over and inserting an element around (before/after) the current position.

2019-05-19 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 19 May 2019 at 20:55:28 UTC, Josh wrote: Just started looking at D this weekend, coming from a C++/Java/Go/Rust background and it's really not going well. Trying to write something to play with the language and need a linked list, looking in std.container you have a single or