queue container?
J Arrizza
cppgent0 at gmail.com
Tue Oct 25 19:38:09 PDT 2011
I need a Queue (put on the front and pop from the back). The best I can
come up with so far is:
Array!string list;
list.insertBack("a1");
list.insertBefore(list.opSlice(0,1), "a2");
list.insertBefore(list.opSlice(0,1), "a3");
list.insertBefore(list.opSlice(0,1), "a4");
list.insertBefore(list.opSlice(0,1), "a5");
while (!list.empty())
{
string s = list.back();
list.removeBack();
writeln("x: ", s);
}
Having to insertBack when the list empty and insertBefore with the range,
seems strange to me. Is there a better way?
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111025/10b4a604/attachment.html>
More information about the Digitalmars-d
mailing list