Topic: STL priority_queue ordering?


Author: "Dan MacDonald" <drmacdon@electrical.watstar.uwaterloo.ca>
Date: 1996/10/25
Raw View
If I store several value's into the priority queue, all having the same
priority level I kind of expected (hoped) them to come back in a FIFO
ordering which doesn't appear to be the case. Reading about how the
heap works, I understand what is happening but I'm not sure what I
should do to fix my ordering.

Does an item not have a higher priority if it was placed on a queue before
an item of "equal priority"?

For example, an operating system would use a priority queue to dispatch
processes based on priority level.  If several processes share the same
priority level and the ordering is not FIFO a process could be potentially
starved.

Have I misunderstood the definition or how to use the priority queue class?

Thanks,
Dan MacDonald
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]