Thread overview
List, Queue and Stack
Jul 14, 2004
Pac
Jul 14, 2004
pragma
Jul 14, 2004
Matthew
July 14, 2004
Hi all,


where are the List Queue and Stack object in phobos ?


Best regards

Pac
July 14, 2004
In article <cd44qs$3ve$1@digitaldaemon.com>, Pac says...
>
>where are the List Queue and Stack object in phobos ?

They're not there explicitly, which isn't a problem because D's arrays are flexible enough to get the job done.

> int[] array;
> int value;
> 
> array ~= value; // append
> array = value ~ array; // prepend
> array = array[0..array.length-1]; // remove last element
> array = array[1..array.length]; // remove first element
> 
> int first = array[array.length-1]; // get last element
> int last = array[0]; // get first element

Just be on the lookout for empty arrays and you're practically home free.

Now, if its classes or templates you crave, then you'll have to write your own or wait for DTL to come out. :(

- Pragma


July 14, 2004
Coming very soon. :)

"Pac" <Pac_member@pathlink.com> wrote in message news:cd44qs$3ve$1@digitaldaemon.com...
> Hi all,
>
>
> where are the List Queue and Stack object in phobos ?
>
>
> Best regards
>
> Pac