Re: Looking for a Simple Doubly Linked List Implementation

2020-10-29 Thread IGotD- via Digitalmars-d-learn
On Thursday, 29 October 2020 at 22:02:52 UTC, Paul Backus wrote: I'm pretty sure the post you replied to is spam. Yes, when I read the post again it is kind of hollow.

Re: Looking for a Simple Doubly Linked List Implementation

2020-10-29 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 29 October 2020 at 18:10:28 UTC, IGotD- wrote: Is this what you are looking for? https://dlang.org/phobos/std_container_dlist.html I'm pretty sure the post you replied to is spam.

Re: Looking for a Simple Doubly Linked List Implementation

2020-10-29 Thread IGotD- via Digitalmars-d-learn
On Thursday, 29 October 2020 at 18:06:55 UTC, xpaceeight wrote: https://forum.dlang.org/post/bpixuevxzzltiybdr...@forum.dlang.org It contains the data and a pointer to the next and previous linked list node. This is given as follows. struct Node { int data; struct Node *prev; struct Node *next

Looking for a Simple Doubly Linked List Implementation

2020-10-29 Thread xpaceeight via Digitalmars-d-learn
https://forum.dlang.org/post/bpixuevxzzltiybdr...@forum.dlang.org It contains the data and a pointer to the next and previous linked list node. This is given as follows. struct Node { int data; struct Node *prev; struct Node *next; }; The function insert() inserts the data into the beginning o

Re: Looking for a Simple Doubly Linked List Implementation

2020-01-29 Thread Barry allen via Digitalmars-d-learn
On Tuesday, 28 January 2020 at 20:20:25 UTC, Barry allen wrote: your linked list seems very complex https://get-shareit.com https://get-vidmateapk.com /* Node of a doubly linked list */ struct Node { int data; struct Node* next; // Pointer to next node in DLL struct Node*

Re: Looking for a Simple Doubly Linked List Implementation

2020-01-28 Thread Barry allen via Digitalmars-d-learn
your linked list seems very complex

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-29 Thread snow jhon via Digitalmars-d-learn
On Saturday, 28 September 2019 at 16:21:10 UTC, snow jhon wrote: On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote: [...] Below is a simple doubly linked list with Garbage Collected memory. It's not performant or complete by any means, just a minimal example in D like you wanted.

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-28 Thread snow jhon via Digitalmars-d-learn
On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote: On Saturday, 21 September 2019 at 08:34:09 UTC, Ron Tarrant wrote: Thanks, Dennis. Not performant... It doesn't work? I was hoping for a complete, working example, but maybe this'll help. Bad word choice (it appears it's debatable w

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-25 Thread Ron Tarrant via Digitalmars-d-learn
On Monday, 23 September 2019 at 22:40:41 UTC, Ali Çehreli wrote: So, what was it then? Append to an array, sort it, and be happy? :) Ali Hi, Ali, It turns out that the GTK Notebook has its own built-in mechanism for tracking tabs. Two things got me going down the wrong road on this: 1)

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-23 Thread Ali Çehreli via Digitalmars-d-learn
On 09/23/2019 01:45 PM, Ron Tarrant wrote: > Well, it turns out, I didn't need a linked list, doubly or otherwise. So, what was it then? Append to an array, sort it, and be happy? :) Ali

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-23 Thread Ron Tarrant via Digitalmars-d-learn
Well, it turns out, I didn't need a linked list, doubly or otherwise. That's what happens when a person quits coffee for a week: complete brain chaos. For a full week, I banged on this, trying to work out a scheme whereby I could track GTK Notebook tabs with a doubly-linked list, an array, an

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, September 21, 2019 12:52:23 PM MDT Dennis via Digitalmars-d- learn wrote: > Since I marked the method as const, `auto a = head` got the type > const(Node!T) and `a = a.next` no longer compiled. With structs > you can declare a const(Node!T)* (mutable pointer to const node), > but I don

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn
Sorry. I posted the wrong file. This is the one that works: ``` import std.stdio; import std.conv; class TabList { private: Tab _head; int _lastUniqueID = 0; string labelText; this() { append(); }

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn
On Saturday, 21 September 2019 at 18:52:23 UTC, Dennis wrote: On Saturday, 21 September 2019 at 08:34:09 UTC, Ron Tarrant wrote: Thanks, Dennis. Not performant... It doesn't work? I was hoping for a complete, working example, but maybe this'll help. Bad word choice (it appears it's debatable w

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Dennis via Digitalmars-d-learn
On Saturday, 21 September 2019 at 08:34:09 UTC, Ron Tarrant wrote: Thanks, Dennis. Not performant... It doesn't work? I was hoping for a complete, working example, but maybe this'll help. Bad word choice (it appears it's debatable whether 'performant' even is a word), I meant it was a simple i

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn
Thanks for all the responses, y'all. I got it figured out thanks to ag0aep6g pointing out something I forgot about the nature of class objects in D (Damn my failing memory). The results will show up on the gtkDcoding blog sometime in (I'm guessing) November as part of the the Notebook discussi

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Alex via Digitalmars-d-learn
On Friday, 20 September 2019 at 20:26:03 UTC, Ron Tarrant wrote: Hi guys, I've been banging my head on the screen with this one for the last week or so. For whatever reason, I'm having major problems understanding how to implement a doubly-linked list in D. I don't know if it's because I'm lo

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 21 September 2019 at 09:03:13 UTC, Ron Tarrant wrote: Ah! Thanks, ag0aep6g. I was wondering about that when I was writing the code. (If I already knew this, I'd forgotten.) I did as you suggested, took out all '*' and '&' and it works perfectly. Is this what you want? --- current

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn
On Saturday, 21 September 2019 at 08:49:48 UTC, ag0aep6g wrote: On 21.09.19 10:34, Ron Tarrant wrote: Here's a question for the room: Does a doubly-linked list always have to be done with structs? Can it be classes instead? (Maybe that's why I can't get it to work, because I've been trying to

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread ag0aep6g via Digitalmars-d-learn
On 21.09.19 10:34, Ron Tarrant wrote: Here's a question for the room: Does a doubly-linked list always have to be done with structs? Can it be classes instead? (Maybe that's why I can't get it to work, because I've been trying to make an OOP version?) It can be done with classes. When I run

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-21 Thread Ron Tarrant via Digitalmars-d-learn
On Friday, 20 September 2019 at 20:35:41 UTC, H. S. Teoh wrote: Not a minimal example by any means, but Phobos *does* come with a doubly-linked list implementation: std.container.dlist. Thanks, H.S. I did come across that in my search. Trouble is, with all the extra stuff in there, I'm having

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-20 Thread Dennis via Digitalmars-d-learn
On Friday, 20 September 2019 at 20:26:03 UTC, Ron Tarrant wrote: If someone could please post a minimal example (if there's extra stuff in there, I'll get confused; I'm getting that old, dammit) I'd be ever so grateful. Below is a simple doubly linked list with Garbage Collected memory. It's

Re: Looking for a Simple Doubly Linked List Implementation

2019-09-20 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Sep 20, 2019 at 08:26:03PM +, Ron Tarrant via Digitalmars-d-learn wrote: > Hi guys, > > I've been banging my head on the screen with this one for the last > week or so. For whatever reason, I'm having major problems > understanding how to implement a doubly-linked list in D. I don't k

Looking for a Simple Doubly Linked List Implementation

2019-09-20 Thread Ron Tarrant via Digitalmars-d-learn
Hi guys, I've been banging my head on the screen with this one for the last week or so. For whatever reason, I'm having major problems understanding how to implement a doubly-linked list in D. I don't know if it's because I'm losing my ability to sort these things or if it's just that differe