3 ms·
All the time. Just recently one of guys I work with got stuck because he was using an STL priority queue to maintain a scheduler's data. The data was keyed on t
by fgb 19y ago
All the time. Just recently one of guys I work with got stuck because he was using an STL priority queue to maintain a scheduler's data. The data was keyed on the time a scheduled event needed to run. The problem was that sometimes an event's time needed to change. Normally theses priority queues do not let you change items on the fly. Things get added and they come out based on their priority. He figured out how to override this behavior but couldn't understand why the priority queue was broken after he modified an item inside the queue directly. So, I had to explain to him how heaps and priority queues worked.