digitalmars.D - queue container?
- J Arrizza (17/17) Oct 25 2011 I need a Queue (put on the front and pop from the back). The best I can
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
Oct 25 2011