Standard C++ Library Class Reference
template <class InputIterator>
priority_queue (InputIterator first, InputIterator last,
const Compare& x = Compare(),
const Allocator& alloc = Allocator());
Constructs a new priority queue and places into it every entity in the range [first, last). The
priority_queue will use x for determining the priority, and the allocator alloc for all storage
management.
Allocator
allocator_type get_allocator () const;
Returns a copy of the allocator used by self for storage management.
Member Functions
bool
empty () const;
Returns true if the priority_queue is empty, false otherwise.
void
pop();
Removes the item with the highest priority from the queue.
void
push (const value_type& x);
Adds x to the queue.
size_type
size () const;
Returns the number of elements in the priority_queue.
const value_type&
top () const;
Returns a constant reference to the element in the queue with the highest priority.
Example
//
// p_queue.cpp
//
#include <queue>
#include <deque>
#include <vector>