blob: 169953f6d59f2518796dff35a273c172f1e54660 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />
<title>priority_queue Interface</title>
<meta http-equiv="Content-Type" content=
"text/html; charset=us-ascii" />
</head>
<body>
<div id="page">
<h1><tt>priority_queue</tt> Interface</h1>
<p>Basic priority queue.</p>
<p>Defined in: <a href=
"../../../../include/ext/pb_ds/priority_queue.hpp"><tt>priority_queue.hpp</tt></a></p>
<h2><a name="link1" id="link1">Template Parameters</a></h2>
<table class="c1" width="100%" border="1" summary=
"Template Parameters">
<tr>
<td width="20%" align="left"><b>Parameter</b></td>
<td width="50%" align="left"><b>Description</b></td>
<td width="30%" align="left"><b>Default Value</b></td>
</tr>
<tr>
<td>
<pre>
<a name="Value_Type216514186" id=
"Value_Type216514186"><b>typename</b> Value_Type</a>
</pre>
</td>
<td>
<p>Value type.</p>
</td>
<td>-</td>
</tr>
<tr>
<td>
<pre>
<a name="Cmp_Fn294335" id="Cmp_Fn294335"><b>class</b> Cmp_Fn </a>
</pre>
</td>
<td>
<p>Comparison functor.</p>
</td>
<td>
<pre>
std::less&lt;<a href=
"#Value_Type216514186"><tt>Value_Type</tt></a>&gt;
</pre>
</td>
</tr>
<tr>
<td>
<pre>
<a name="Tag278938" id="Tag278938"><b>class</b> Tag </a>
</pre>
</td>
<td>
<p>Data-structure tag.</p>
</td>
<td><a href="pairing_heap_tag.html"><span class=
"c2"><tt>pairing_heap_tag</tt></span></a></td>
</tr>
<tr>
<td>
<pre>
<a name="Allocator35940069" id=
"Allocator35940069"><b>class</b> Allocator </a>
</pre>
</td>
<td>
<p>Allocator type.</p>
</td>
<td>
<pre>
std::allocator&lt;<b>char</b>&gt;
</pre>
</td>
</tr>
</table>
<h2><a name="link2" id="link2">Public Types and
Constants</a></h2>
<h3><a name="link3" id="link3">General Container
Definitions</a></h3>
<table class="c1" width="100%" border="1" summary="Types">
<tr>
<td width="30%" align="left"><b>Type</b></td>
<td width="55%" align="left"><b>Definition</b></td>
<td width="15%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<a name="size_type55424436" id="size_type55424436">size_type</a>
</pre>
</td>
<td>
<pre>
<b>typename</b> <a href=
"#Allocator35940069"><tt>Allocator</tt></a>::size_type
</pre>
</td>
<td>
<p>Size type.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="difference_type868028452" id=
"difference_type868028452">difference_type</a>
</pre>
</td>
<td>
<pre>
<b>typename</b> <a href=
"#Allocator35940069"><tt>Allocator</tt></a>::difference_type
</pre>
</td>
<td>
<p>Difference type.</p>
</td>
</tr>
</table>
<h3><a name="link4" id="link4">Categories</a></h3>
<table class="c1" width="100%" border="1" summary="Types">
<tr>
<td width="30%" align="left"><b>Type</b></td>
<td width="55%" align="left"><b>Definition</b></td>
<td width="15%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<a name="container_category1247973216" id=
"container_category1247973216">container_category</a>
</pre>
</td>
<td>
<pre>
<a href="#Tag278938"><tt>Tag</tt></a>
</pre>
</td>
<td>
<p>The underlying mapped-structure tag of the
container.</p>
<p>This is one of:</p>
<ol>
<li><a href="binary_heap_tag.html"><span class=
"c2"><tt>binary_heap_tag</tt></span></a></li>
<li><a href="binomial_heap_tag.html"><span class=
"c2"><tt>binomial_heap_tag</tt></span></a></li>
<li><a href="rc_binomial_heap_tag.html"><span class=
"c2"><tt>rc_binomial_heap_tag</tt></span></a></li>
<li><a href="pairing_heap_tag.html"><span class=
"c2"><tt>pairing_heap_tag</tt></span></a></li>
<li><a href="thin_heap_tag.html"><span class=
"c2"><tt>thin_heap_tag</tt></span></a></li>
</ol>
</td>
</tr>
</table>
<h3><a name="link5" id="link5">Policy Definitions</a></h3>
<table class="c1" width="100%" border="1" summary="Types">
<tr>
<td width="30%" align="left"><b>Type</b></td>
<td width="55%" align="left"><b>Definition</b></td>
<td width="15%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<a name="cmp_fn394495" id="cmp_fn394495">cmp_fn</a>
</pre>
</td>
<td>
<pre>
<a href="#Cmp_Fn294335"><tt>Cmp_Fn</tt></a>
</pre>
</td>
<td>
<p>Comparison functor type.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="allocator48440069" id="allocator48440069">allocator</a>
</pre>
</td>
<td>
<pre>
<a href="#Allocator35940069"><tt>Allocator</tt></a>
</pre>
</td>
<td>
<p><a href="#Allocator35940069"><tt>Allocator</tt></a>
type.</p>
</td>
</tr>
</table>
<h3><a name="link6" id="link6">Value-Type Definitions</a></h3>
<table class="c1" width="100%" border="1" summary="Types">
<tr>
<td width="30%" align="left"><b>Type</b></td>
<td width="55%" align="left"><b>Definition</b></td>
<td width="15%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<a name="value_type279018186" id=
"value_type279018186">value_type</a>
</pre>
</td>
<td>
<pre>
<a href="#Value_Type216514186"><tt>Value_Type</tt></a>
</pre>
</td>
<td>
<p>Value type.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="reference54418471" id="reference54418471">reference</a>
</pre>
</td>
<td>
<pre>
<b>typename</b> <a href=
"#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind&lt;
<a href=
"#value_type279018186"><tt>value_type</tt></a>&gt;::other::reference
</pre>
</td>
<td>
<p>Value reference type.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="const_reference495461441" id=
"const_reference495461441">const_reference</a>
</pre>
</td>
<td>
<pre>
<b>typename</b> <a href=
"#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind&lt;
<a href=
"#value_type279018186"><tt>value_type</tt></a>&gt;::other::const_reference
</pre>
</td>
<td>
<p>Const value <a href=
"#reference54418471"><tt>reference</tt></a> type.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="pointer2179769" id="pointer2179769">pointer</a>
</pre>
</td>
<td>
<pre>
<b>typename</b> <a href=
"#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind&lt;
<a href=
"#value_type279018186"><tt>value_type</tt></a>&gt;::other::pointer
</pre>
</td>
<td>
<p>Value pointer type.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="const_pointer878814947" id=
"const_pointer878814947">const_pointer</a>
</pre>
</td>
<td>
<pre>
<b>typename</b> <a href=
"#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind&lt;
<a href=
"#value_type279018186"><tt>value_type</tt></a>&gt;::other::const_pointer
</pre>
</td>
<td>
<p>Const Value <a href=
"#pointer2179769"><tt>pointer</tt></a> type.</p>
</td>
</tr>
</table>
<h3><a name="link7" id="link7">Iterator Definitions</a></h3>
<table class="c1" width="100%" border="1" summary="Types">
<tr>
<td width="30%" align="left"><b>Type</b></td>
<td width="55%" align="left"><b>Definition</b></td>
<td width="15%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<a name="const_point_iterator2364676009" id=
"const_point_iterator2364676009">const_point_iterator</a>
</pre>
</td>
<td>
<pre>
Const point-type iterator.
</pre>
</td>
<td>
<p>Const point-type iterator.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="point_iterator2789896775" id=
"point_iterator2789896775">point_iterator</a>
</pre>
</td>
<td>
<pre>
Point-type iterator.
</pre>
</td>
<td>
<p>Point-type iterator.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="const_iterator98626788" id=
"const_iterator98626788">const_iterator</a>
</pre>
</td>
<td>
<pre>
Const range-type iterator.
</pre>
</td>
<td>
<p>Const range-type iterator.</p>
</td>
</tr>
<tr>
<td>
<pre>
<a name="iterator10418194" id="iterator10418194">iterator</a>
</pre>
</td>
<td>
<pre>
Range-type iterator.
</pre>
</td>
<td>
<p>Range-type iterator.</p>
</td>
</tr>
</table>
<h2><a name="link8" id="link8">Public Methods</a></h2>
<h3><a name="link9" id="link9">Constructors, Destructor, and
Related</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
priority_queue
()
</pre>
</td>
<td>
<p>Default constructor.</p>
</td>
</tr>
<tr>
<td>
<pre>
priority_queue
(<b>const</b> <a href=
"#cmp_fn394495"><tt>cmp_fn</tt></a> &amp;r_cmp_fn)
</pre>
</td>
<td>
<p>Constructor taking some policy objects. <span class=
"c1"><tt>r_cmp_fn</tt></span> will be copied by the
<a href="#Cmp_Fn294335"><tt>Cmp_Fn</tt></a> object of the
container object.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>template</b>&lt;
<b>class</b> It&gt;
priority_queue
(It first_it,
It last_it)
</pre>
</td>
<td>
<p>Constructor taking iterators to a range of <a href=
"#value_type279018186"><tt>value_type</tt></a>s. The
<a href="#value_type279018186"><tt>value_type</tt></a>s
between <span class="c1"><tt>first_it</tt></span> and
<span class="c1"><tt>last_it</tt></span> will be inserted
into the container object.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>template</b>&lt;
<b>class</b> It&gt;
priority_queue
(It first_it,
It last_it,
<b>const</b> <a href=
"#cmp_fn394495"><tt>cmp_fn</tt></a> &amp;r_cmp_fn)
</pre>
</td>
<td>
<p>Constructor taking iterators to a range of <a href=
"#value_type279018186"><tt>value_type</tt></a>s and some
policy objects The <a href=
"#value_type279018186"><tt>value_type</tt></a>s between
<span class="c1"><tt>first_it</tt></span> and
<span class="c1"><tt>last_it</tt></span> will be inserted
into the container object. <span class=
"c1"><tt>r_cmp_fn</tt></span> will be copied by the
<a href="#cmp_fn394495"><tt>cmp_fn</tt></a> object of the
container object.</p>
</td>
</tr>
<tr>
<td>
<pre>
priority_queue
(<b>const</b> <span class=
"c2"><tt>priority_queue</tt></span> &amp;other)
</pre>
</td>
<td>
<p>Copy constructor.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>virtual</b>
~priority_queue
()
</pre>
</td>
<td>
<p>Destructor.</p>
</td>
</tr>
<tr>
<td>
<pre>
<span class="c2"><tt>priority_queue</tt></span> &amp;
<b>operator</b>=
(<b>const</b> <span class=
"c2"><tt>priority_queue</tt></span> &amp;other)
</pre>
</td>
<td>
<p>Assignment operator.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>void</b>
swap
(<span class="c2"><tt>priority_queue</tt></span> &amp;other)
</pre>
</td>
<td>
<p>Swaps content.</p>
</td>
</tr>
</table>
<h3><a name="link10" id="link10">Information Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href="#size_type55424436"><tt>size_type</tt></a>
size
() <b>const</b>
</pre>
</td>
<td>
<p>Returns the number of distinct <a href=
"#value_type279018186"><tt>value_type</tt></a> objects
the container object is storing.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href="#size_type55424436"><tt>size_type</tt></a>
max_size
() <b>const</b>
</pre>
</td>
<td>
<p>Returns an upper bound on the number of distinct
<a href="#value_type279018186"><tt>value_type</tt></a>
objects this container can store.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <b>bool</b>
empty
() <b>const</b>
</pre>
</td>
<td>
<p>Returns whether the container object is not storing
any <a href=
"#value_type279018186"><tt>value_type</tt></a>
objects.</p>
</td>
</tr>
</table>
<h3><a name="link11" id="link11">Insert Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href=
"#point_iterator2789896775"><tt>point_iterator</tt></a>
push
(<a href=
"#const_reference495461441"><tt>const_reference</tt></a> r_val)
</pre>
</td>
<td>
<p>Inserts a <a href=
"#value_type279018186"><tt>value_type</tt></a> object.
returns a <a href=
"#point_iterator2789896775"><tt>point_iterator</tt></a>
object associated with the new pushed <span class=
"c1"><tt>r_val</tt></span>.</p>
</td>
</tr>
</table>
<h3><a name="link12" id="link12">Find Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href=
"#const_reference495461441"><tt>const_reference</tt></a>
top
() <b>const</b>
</pre>
</td>
<td>
<p>Returns the <a href=
"#const_reference495461441"><tt>const_reference</tt></a>
of the largest <a href=
"#value_type279018186"><tt>value_type</tt></a> in the
container object, i.e., a <a href=
"#value_type279018186"><tt>value_type</tt></a> v_max for
which any other <a href=
"#value_type279018186"><tt>value_type</tt></a> v in the
container object will satisfy !<a href=
"#cmp_fn394495"><tt>cmp_fn</tt></a>()(v_max, v).</p>
</td>
</tr>
</table>
<h3><a name="link13" id="link13">Modify Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <b>void</b>
modify
(<a href=
"#point_iterator2789896775"><tt>point_iterator</tt></a> it,
<a href=
"#const_reference495461441"><tt>const_reference</tt></a> r_new_val)
</pre>
</td>
<td>
<p>Modifies the <a href=
"#value_type279018186"><tt>value_type</tt></a> associated
with the <a href=
"#point_iterator2789896775"><tt>point_iterator</tt></a>
<span class="c1"><tt>it</tt></span> into <span class=
"c1"><tt>r_new_val</tt></span>.</p>
<p>To use this method, <a href=
"#value_type279018186"><tt>value_type</tt></a> must be
assignable.</p>
</td>
</tr>
</table>
<h3><a name="link14" id="link14">Erase Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <b>void</b>
pop
()
</pre>
</td>
<td>
<p>Pops the largest <a href=
"#value_type279018186"><tt>value_type</tt></a>.</p>
<p>If the container object is empty, results are
undefined.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <b>void</b>
erase
(<a href=
"#point_iterator2789896775"><tt>point_iterator</tt></a> it)
</pre>
</td>
<td>
<p>Erases the <a href=
"#value_type279018186"><tt>value_type</tt></a> associated
with the <a href=
"#point_iterator2789896775"><tt>point_iterator</tt></a>
<span class="c1"><tt>it</tt></span>.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>template</b>&lt;
<b>class</b> Pred&gt;
<b>inline</b> <a href="#size_type55424436"><tt>size_type</tt></a>
erase_if
(Pred prd)
</pre>
</td>
<td>
<p>Erases any <a href=
"#value_type279018186"><tt>value_type</tt></a> satisfying
the predicate <span class="c1"><tt>prd</tt></span>;
returns the number of <a href=
"#value_type279018186"><tt>value_type</tt></a>s
erased.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>void</b>
clear
()
</pre>
</td>
<td>
<p>Clears the container object.</p>
</td>
</tr>
</table>
<h3><a name="link15" id="link15">Split and join
Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>void</b>
join
(<span class="c2"><tt>priority_queue</tt></span> &amp;other)
</pre>
</td>
<td>
<p>Joins two container objects. When this function
returns, <span class="c1"><tt>other</tt></span> will be
empty.</p>
<p>When calling this method, <span class=
"c1"><tt>other</tt></span>'s policies must be
equivalent to this object's policies.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>template</b>&lt;
<b>class</b> Pred&gt;
<b>inline</b> <b>void</b>
split
(Pred prd,
<span class="c2"><tt>priority_queue</tt></span> &amp;other)
</pre>
</td>
<td>
<p>Splits into two container objects. When this function
returns, <span class="c1"><tt>other</tt></span> will be
contain only values v for which <span class=
"c1"><tt>prd</tt></span>(v) is <tt><b>true</b></tt>.</p>
<p>When calling this method, <span class=
"c1"><tt>other</tt></span>'s policies must be
equivalent to this object's policies.</p>
</td>
</tr>
</table>
<h3><a name="link16" id="link16">Iteration Methods</a></h3>
<table class="c1" width="100%" border="1" summary="Methods">
<tr>
<td width="45%" align="left"><b>Method</b></td>
<td width="55%" align="left"><b>Description</b></td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href="#iterator10418194"><tt>iterator</tt></a>
begin
()
</pre>
</td>
<td>
<p>Returns an <a href=
"#iterator10418194"><tt>iterator</tt></a> corresponding
to the first <a href=
"#value_type279018186"><tt>value_type</tt></a> in the
container.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href=
"#const_iterator98626788"><tt>const_iterator</tt></a>
begin
() <b>const</b>
</pre>
</td>
<td>
<p>Returns a <a href=
"#const_iterator98626788"><tt>const_iterator</tt></a>
corresponding to the first <a href=
"#value_type279018186"><tt>value_type</tt></a> in the
container.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href="#iterator10418194"><tt>iterator</tt></a>
end
()
</pre>
</td>
<td>
<p>Returns an <a href=
"#iterator10418194"><tt>iterator</tt></a> corresponding
to the just-after-last <a href=
"#value_type279018186"><tt>value_type</tt></a> in the
container.</p>
</td>
</tr>
<tr>
<td>
<pre>
<b>inline</b> <a href=
"#const_iterator98626788"><tt>const_iterator</tt></a>
end
() <b>const</b>
</pre>
</td>
<td>
<p>Returns a <a href=
"#const_iterator98626788"><tt>const_iterator</tt></a>
corresponding to the just-after-last <a href=
"#value_type279018186"><tt>value_type</tt></a> in the
container.</p>
</td>
</tr>
</table>
</div>
</body>
</html>