Diff
Not logged in

Differences From Artifact [a342d9597f1d9525]:

To Artifact [3ef79e5266d25568]:


83 83 84 84 class Queue(T) 85 85 { 86 86 alias Tuple!(T,int) t; 87 87 88 88 t[] cur, next; 89 89 90 - void push(T v, int p) { (cur.empty ? cur : next) ~= tuple(v,p); } 90 + void push(T v, int p) { if(cur.empty) cur ~= tuple(v,p); else next ~= tuple(v,p); } 91 91 bool empty() { return cur.empty; } 92 92 t pop() { 93 93 t v = cur[0]; cur = cur[1..$]; 94 94 if(cur.empty) { cur = next; next = null; } 95 95 return v; 96 96 } 97 97 }