std.experimental.collection.functional.slist

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 18 17:24:19 PDT 2015


"JDemler" <jakob.demler at stud-mail.uni-wuerzburg.de> wrote:
> On Thursday, 18 June 2015 at 23:32:03 UTC, Andrei Alexandrescu wrote:
>> First pass illustrating the basic data layout:
>> 
>> http://dpaste.dzfl.pl/0d4a589ad6f5
>> 
>> Code is obviously barebones but passes tests and works with > allocators.
>> 
>> Notes:
>> 
>> * I managed to not store one allocator per node, but there's > one
>> allocator per range. That's needed if we want "orphan > ranges" to work,
>> i.e. ranges that survive the list they came > from. This is a clasic
>> convenience vs. efficiency thing.
>> 
>> * There's a refcount per node because any given node may belong > to multiple lists.
>> 
>> * Refcounting is interesting because many nodes are only used > by the
>> previous node. So destroying a list is... funny. Never > saw or wrote
>> code like this previously. See nukeTransitively.
>> 
>> All in all things seem convex. Please destroy appropriately.
>> 
>> 
>> Thanks,
>> 
>> Andrei
> 
> Before being able to compile your code i have some very basic questions:
> 
> 1. Where can I find 'std/experimental/allocator.d'? The compiler seems to
> want it and i cannot find it in either
> https://github.com/andralex/phobos/tree/allocator/std/experimental/allocator or
> https://github.com/D-Programming-Language/phobos/tree/master/std/experimental

Should be around there, I'm on the phone now so can't check. It's
std/experimental/allocator/package.d

> 2. What is the rationale behind a singly linked list? Or is it just to
> experiment with collections and allocators?

It's the simplest collection that's meaningful. So I chose it as proof of
concept.


More information about the Digitalmars-d mailing list