<div class="gmail_quote">On 30 March 2011 10:38, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On 2011-03-30 01:18, Daniel Gibson wrote:<br>
> Am 30.03.2011 01:55, schrieb Jonathan M Davis:<br>
> > On 2011-03-29 14:50, dsimcha wrote:<br>
> >> == Quote from Jonathan M Davis (<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>)'s article<br>
> >><br>
> >>> The fancier stuff would be nice, but we don't even have a doubly-linked<br>
> >>> list yet. We should get the simpler stuff sorted out before we get<br>
> >>> particularly fancy, not to mention that it's usually the simple stuff<br>
> >>> that gets heavily used.<br>
> >><br>
> >> For the most part I agree, but a doubly linked list might be **too**<br>
> >> simple. Linked lists are so trivial to implement that I'd tend to roll<br>
> >> my own that does exactly what I need with regard additional behavior on<br>
> >> insertion, etc. rather than wrapping a library solution to get these<br>
> >> features.<br>
> ><br>
> > A doubly-linked list is on the list of containers that every standard<br>
> > library should have or it's likely to be considered lacking. I can<br>
> > understand rolling your own for specific uses, but _I_ sure don't want<br>
> > to be doing that if I don't have to. If I want a doubly-linked list, I<br>
> > want to be able to just create a standard one and use it. C++, C#, and<br>
> > Java all have doubly-linked lists in their standard libraries.<br>
> ><br>
> > If no one else ever implements a doubly-linked list for Phobos, I'll<br>
> > probably do it eventually simply because it's one of the containers that<br>
> > is on the short list of containers that pretty much every standard<br>
> > library has.<br>
> ><br>
> > - Jonathan M Davis<br>
><br>
> It may be feasible to enhance the single-linked list to support both<br>
> single- and double linking, via an additional template-parameter "bool<br>
> doubly" or something like that and some static-ifs in the implementation.<br>
> I once created a simple single/double-linked queue for D1 like that.<br>
<br>
</div></div>To what end though? I don't think that that would save you much. While some of<br>
the implementation would be the same, so much of it would be different, that<br>
you'd practically have two complete types defined in one template. At that<br>
point, you might as well create a separate class/struct. It's just simpler to<br>
have them separate, and I don't see any real gain in combining them. Having<br>
both is great, since there are times that you want one and times when you want<br>
the other, but having both SList and DList (or whatever it would be called) as<br>
separate types makes sense.<br>
<font color="#888888"><br>
- Jonathan M Davis<br>
</font></blockquote></div><br><br><div>Just a question that popped into my mind, how does D's std.container handle cyclic lists? using static if?</div><div><br>-- <br>// Yours sincerely<br>// Emil 'Skeen' Madsen<br>

</div>