std.container update

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed May 26 21:36:24 PDT 2010


I just implemented a singly-linked list type to illustrate the container 
abstraction.

http://erdani.com/d/phobos/std_container.html
http://erdani.com/d/phobos/container.d

One interesting aspect is that SList must cooperate with Take. More 
details are to be found in code, but essentially SList ranges are all 
sentinel-terminated, which makes them "right-bound". If you want to only 
remove a few elements from the middle of a list, you need to construct a 
range that spans a limited portion of the list. I encoded that by using 
the Take abstraction in std.range.

Please let me know of how you find it. There are a few refinements and 
ancillary functions to define, but those are pretty clear given the rest.


Andrei


More information about the Digitalmars-d mailing list