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?

Thanks!

Recommended Answers

All 2 Replies

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...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.