📄 pqueue.htm
字号:
<html>
<head>
<title> The priority_queue Class</title>
</head>
<body bgcolor="#FFFFFF">
<img src="pqueban.gif">
<pre>
<font size=5>Class Name</font> priority_queue
<font size=5>Header File</font> <queue>
<font size=5>Classification</font> Container
</pre>
<a href="pqueue.htm#desc">Class Description</a><br>
<h1>Member Classes</h1>
<i>None</i>
<h1>Methods</h1>
<pre>
<a href="common.htm#empty">bool empty() const</a><br>
<a href="common.htm#size">size_type size() const</a><br>
<a href="vector.htm#pushback">void push(const value_type& x)</a><br>
<a href="vector.htm#popfront">void pop()</a><br>
<a href="pqueue.htm#pqueue1">explicit priority_queue(const Compare& X = Compare(),const Container&Cont = Container())</a><br>
<a href="pqueue.htm#pqueue2">template <class InputIterator> priority_queue(InputIterator first, InputIterator last, const Compare& x = Compare(), const Container& = Container())</a><br>
<a href="vector.htm#front">const value_type& top()</a><br>
</pre>
<h2><a href="operator.htm">Operators</h2></a><br>
<a name="desc"><h3>Class Description</h3></a>
<p>
A priority queue is an ordered queue. This means that the objects that are placed into a priority
queue are sorted into some kind of order. However, this does not change the restriction of only
being able to dequeue from the front of the queue and enqueue into the rear of the queue.
There are two types of priority queues, descending priority queues and ascending priority queues.
In a descending priority queue the objects are sorted from largest to smallest. The largest object
is dequeued from the queue, and then the next largest object is dequeued, and so on. In
this way the queue is said to be descending, because as the values are dequeued they get smaller.
The ascending priority queue is just the opposite. In a ascending queue the object are stored in
sequence from smallest to largest. The container class library priority_queue is a adaptor or
interface class.
</p>
<hr>
<pre>
<a name="pqueue1">Method priority_queue()</a>
Access Public
Classification Constructor
Syntax explicit priority_queue(const Compare& X = Compare(),const Container&Cont = Container())
Parameters X is the function object that will be used to order the priority_queue.
The objects in Cont will be used to construct a new priority_queue.
Return None
</pre>
<h3>Description</h3>
<p>
This priority_queue() method constructs a queue that contains copies of elements in Cont.
</p>
<hr>
<pre>
<a name="pqueue2">Method priority_queue()</a>
Access Public
Classification Constructor
Syntax template <class InputIterator> priority_queue(InputIterator first, InputIterator last, const Compare& X = Compare(), const Container&Cont = Container())
Parameters X is the function object that will be used to order the priority queue.
The objects in Cont will be used to construct a new priority_queue.
The objects will be from the range[first,last).
Return None
</pre>
<h3>Description</h3>
<p>
This priority_queue() method constructs a queue that contains copies of elements in Cont in the
range [first,last).
</p>
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -