FIFO stack

Marco Leise Marco.Leise at gmx.de
Sat Nov 5 14:39:18 PDT 2011


Am 26.10.2011, 18:00 Uhr, schrieb Dominic Jones <dominic.jones at qmul.ac.uk>:

>> Also an plain array is a good stack. :)
>
> I'd rather not use a plain array because (I assume) that when I push
> or pop using arrays, a swap array is created to resize the original.
> If this is not the case, then an array will certainly do.
> -Dominic

Someone could have told me that the topic wasn't FILO stacks ^^. A "FILO"  
stack can use a dynamic array with assumeSafeAppend, which avoids the copy  
by telling the runtime that I definitely wont overwrite anything valuable  
in the array when I write pop(); push(...); (There are no other array  
slices operating on the same data block)


More information about the Digitalmars-d-learn mailing list