The object allocates and frees storage for the sequence it controls through an underlying container, of type Container, that stores Value elements and grows on demand. It keeps the sequence ordered as a heap, with the highest-priority element (the top element) readily accessible and removable. The object restricts access to pushing new elements and popping just the highest-priority element, implementing a priority queue.
The object orders the sequence it controls by calling a stored delegate object of type priority_queue::value_compare (STL/CLR). You can specify the stored delegate object when you construct the priority_queue; if you specify no delegate object, the default is the comparison operator<(value_type, value_type). You access this stored object by calling the member function priority_queue::value_comp (STL/CLR)().
Such a delegate object must impose a strict weak ordering on values of type priority_queue::value_type (STL/CLR). That means, for any two keys X and Y:
value_comp()(X, Y) returns the same Boolean result on every call.
If value_comp()(X, Y) is true, then value_comp()(Y, X) must be false.
If value_comp()(X, Y) is true, then X is said to be ordered before Y.
If !value_comp()(X, Y) && !value_comp()(Y, X) is true, then X and Y are said to have equivalent ordering.
For any element X that precedes Y in the controlled sequence, key_comp()(Y, X) is false. (For the default delegate object, keys never decrease in value.)
The highest priority element is thus one of the elements which is not ordered before any other element.
Since the underlying container keeps elements ordered as a heap:
The container must support random-access iterators.
Elements with equivalent ordering may be popped in a different order than they were pushed. (The ordering is not stable.)
Thus, candidates for the underlying container include deque (STL/CLR) and vector (STL/CLR).