Hi guys,

I am looking for an STL solution for the following problem. The desired behaviour is the following:

- It should act as a priority queue
- When an item is added, the item with the *lowest* priority should be dropped.

I thought of doing that by making a priority_queue from a deque, but I can't access the original member functions of the deque. Is there a way to access those, or is there an alternative solution I am overlooking here? Or should I resort to just using a set, including the log n penalty for storing, removing and searching?


Edited by flying_bird: n/a

8 Years
Discussion Span
Last Post by flying_bird

So, in case the queue reaches a certain limit, the item with the *lowest* priority should be dropped; but normal popping from the queue should give me the item with the *highest* priority.

AFAI see, the problem is that the priority_queue doesn't offer functionality to pop from both sides of the queue...

Edited by flying_bird: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.