C++: Simplify the priority queue.