www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - List, Queue and Stack

reply Pac <Pac_member pathlink.com> writes:
Hi all,


where are the List Queue and Stack object in phobos ?


Best regards

Pac
Jul 14 2004
next sibling parent pragma <EricAnderton at yahoo dot com> <pragma_member pathlink.com> writes:
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
Jul 14 2004
prev sibling parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
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
Jul 14 2004