Differences From Artifact [a342d9597f1d9525]:
- File
src/solver.d
- 2012-07-16 10:18:57 - part of checkin [7bd1ed1180] on branch trunk - more. (user: kinaba) [annotate]
To Artifact [3ef79e5266d25568]:
- File
src/solver.d
- 2013-03-16 01:15:25 - part of checkin [d95246eada] on branch trunk - Make it build on dmd 2.062. (user: kinaba) [annotate]
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 }