Description
priority_queue is used to represent an ordered queue of elements. Ordering defaults to use of <, but a user-defined comparison class can be defined. If you insert a series of elements, and then do a top(), the largest one will be returned.
Declaration
template <class T, class C = vector<T>, class Cmp = less<typename C::value_type> > class std::priority_queue;
Concept
The sample program sets up a queue, specifying a user-defined comparison class. Elements are pushed onto the queue, and then popped off in prioritized order. 300 comes first, then -200, then 100. -200 comes before 100 because it's considered larger, according to the comparison class that was specified.
Supported
Supported
Supported