queue container?

Timon Gehr timon.gehr at gmx.ch
Wed Oct 26 03:07:26 PDT 2011


On 10/26/2011 11:28 AM, bearophile wrote:
> Gor Gyolchanyan:
>
>> The best implementation of queue IMO is using a doubly-linked list,
>
> On modern CPUs there is a better implementation:
> http://pages.cpsc.ucalgary.ca/~kremer/STL/1024x768/deque.html
> http://www.martinbroadhurst.com/articles/deque.html
>
> Essentially a dynamic (on the right) array of fixed-size arrays managed by pointer (in D you need to wrap the small arrays in a struct, I presume, because of the curious way D arrays are designed).
>
> Bye,
> bearophile

A dynamic array of pointers to fixed size arrays is this:

T[N]*[] arr;

What would you wrap exactly?


Do you know how this implementation compares to a circular buffer 
implementation? I'd have expected that to be faster.


More information about the Digitalmars-d mailing list