Diff
Not logged in

Differences From Artifact [a342d9597f1d9525]:

To Artifact [3ef79e5266d25568]:


83 83 84 class Queue(T) 84 class Queue(T) 85 { 85 { 86 alias Tuple!(T,int) t; 86 alias Tuple!(T,int) t; 87 87 88 t[] cur, next; 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 ~= tu 91 bool empty() { return cur.empty; } 91 bool empty() { return cur.empty; } 92 t pop() { 92 t pop() { 93 t v = cur[0]; cur = cur[1..$]; 93 t v = cur[0]; cur = cur[1..$]; 94 if(cur.empty) { cur = next; next = null; } 94 if(cur.empty) { cur = next; next = null; } 95 return v; 95 return v; 96 } 96 } 97 } 97 }