View Single Post
Old 03-05-2005, 10:46 PM   #12
Rhuarc
Member
 
Join Date: Jul 2003
Posts: 50
Rhuarc is on a distinguished road
Exactly. and IMHO, a priority_queue is not the ideal structure for this work. Oh, maybe it's OK if all you have to worry about is when the event fires. If you never have to do any other processing on the events, then sure - use a priority_queue if you like - but even then, it's a trade off between the number of inserts/deletes into the queue, and the number of items you have to iterate through. Only solid profiling is going to give a "this container is better in these circumstances than that container" kind of answer. Generally though, adding/removing elements to a vector is slower (by far) then adding/removing elements to a list. Adding/removing elements in a sorted manner to a vector is slower still.

(Weak referencing does not apply - the elements still have to be removed from the queue at some point, regardless of how that's done)
Rhuarc is offline   Reply With Quote