alias P = int; alias V = string; alias PQ = PriorityQueue!(P, V); PQ pq; import std.typecons: tuple; pq.insert(10, `10`); pq.insert(11, `11`); pq.insert(tuple(3, `3`)); foreach (const e; pq) {} // iteration assert(!pq.empty); // shouldn't consume queue assert(pq.front == tuple(3, `3`)); pq.popFront(); assert(pq.front == tuple(10, `10`)); pq.popFront(); assert(pq.front == tuple(11, `11`)); pq.popFront(); assert(pq.empty);