eliminating std.range.SListRange?

Jonathan M Davis jmdavisProg at gmail.com
Sun May 30 19:47:04 PDT 2010

bearophile wrote:

> Ellery Newcomer:
>> I think you just program too much in python <g>
> On modern CPUs most times liked lists are the wrong data structure to use.
> They are slower, use more memory, can be less handy and less safe. There
> are few situations where a single/double linked list is better, but they
> are quite uncommon (for example when you have often to add/remove items
> from the middle of a sequence and you can find such points quickly, this
> happens for example in the dancing link algorithm).
> Bye,
> bearophile

Uncommon? Sure, if you don't need the ability to arbitrarily add and remove 
elements from a container, then a vector type is definitely better than a 
linked list. However, there are _plenty_ of cases out there where the 
ability to arbitrarily add and remove elements from a container is a 
necessity. It depends entirely on the algorithm that you're using and what 
you're trying to do. Just because you, personally, don't run into many 
situations where linked lists are needed does not mean that others don't.

Linked lists are a basic, vital data structure in any good container 
library. True, it's best to prefer vector types when you don't need the 
specific abilities of a linked list, but that does not mean that the linked 
list isn't going to be frequently used, just that it shouldn't be used when 
it isn't needed.

- Jonathan M Davis

More information about the Digitalmars-d mailing list