dcollections how to LinkList // port c# code

2010-06-29 Thread BLS
Hi, in C# this is common. private ListServer _servers; _servers = new ListServer { new Server{ Name = ServerI, IP = 120.14.220.18 }, new Server{ Name = ServerII, IP = 120.14.220.19 }, new Server{ Name = ServerIII, IP = 120.14.220.20 }, new Server{

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread bearophile
BLS: D2 so far.. import dcollections.LinkList; In D use dynamic arrays unless you really need to remove or add a lot of items from the start or middle of the sequence. On modern CPUs linked lists are usually the wrong data structure to use. Bye, bearophile

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread Byron Heads
On Tue, 29 Jun 2010 15:27:41 -0400, bearophile wrote: In D use dynamic arrays unless you really need to remove or add a lot of items from the start or middle of the sequence. On modern CPUs linked lists are usually the wrong data structure to use. Bye, bearophile D's dynamic arrays are

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread Steven Schveighoffer
On Tue, 29 Jun 2010 15:22:30 -0400, BLS windev...@hotmail.de wrote: Hi, in C# this is common. private ListServer _servers; _servers = new ListServer { new Server{ Name = ServerI, IP = 120.14.220.18 }, new Server{ Name = ServerII, IP = 120.14.220.19 },

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread BLS
On 29/06/2010 22:12, Steven Schveighoffer wrote: For now, can you do something like this? sl = new ServerList; sl.add([ new Server(ServerI, 120.14.220.18), new Server(...) ... ]); Hi Steve, I think this should work, however I got very strange err. msg. in file ArrayList.d Have

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread Steven Schveighoffer
On Tue, 29 Jun 2010 17:33:13 -0400, BLS windev...@hotmail.de wrote: On 29/06/2010 22:12, Steven Schveighoffer wrote: For now, can you do something like this? sl = new ServerList; sl.add([ new Server(ServerI, 120.14.220.18), new Server(...) ... ]); Hi Steve, I think this should

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread BLS
On 29/06/2010 23:49, Steven Schveighoffer wrote: One thing to note, ArrayList *does* accept an array as a constructor, and it will actually use that array as its storage. This is so you can wrap an array as a ArrayList and get the full dcollections functionality from it. Hi Steve This is why

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread Byron Heads
Just a few things that may cause you some bugs/errors On Tue, 29 Jun 2010 23:33:13 +0200, BLS wrote: On 29/06/2010 22:12, Steven Schveighoffer wrote: // Confirm these are the same instance if (b1 == b2 b2 == b3 ) { writeln(Same instance\n); } I think you mean to

Re: dcollections how to LinkList // port c# code

2010-06-29 Thread bearophile
Byron Heads: this(string name, string id) { this._name = _name; this._id = id; } this._name = name; // you had _name I have just filed a bug report on this (it's a lot of time I want to write it):