1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <meta name="generator" content=
7 "HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" />
9 <title>priority_queue Interface</title>
10 <meta http-equiv="Content-Type" content=
11 "text/html; charset=us-ascii" />
16 <h1><tt>priority_queue</tt> Interface</h1>
18 <p>Basic priority queue.</p>
20 <p>Defined in: <a href=
21 "http://gcc.gnu.org/viewcvs/*checkout*/trunk/libstdc%2B%2B-v3/include/ext/pb_ds/priority_queue.hpp"><tt>priority_queue.hpp</tt></a></p>
23 <h2><a name="link1" id="link1">Template Parameters</a></h2>
25 <table class="c1" width="100%" border="1" summary=
26 "Template Parameters">
28 <td width="20%" align="left"><b>Parameter</b></td>
30 <td width="50%" align="left"><b>Description</b></td>
32 <td width="30%" align="left"><b>Default Value</b></td>
38 <a name="Value_Type216514186" id=
39 "Value_Type216514186"><b>typename</b> Value_Type</a>
53 <a name="Cmp_Fn294335" id="Cmp_Fn294335"><b>class</b> Cmp_Fn </a>
58 <p>Comparison functor.</p>
64 "#Value_Type216514186"><tt>Value_Type</tt></a>>
72 <a name="Tag278938" id="Tag278938"><b>class</b> Tag </a>
77 <p>Data-structure tag.</p>
80 <td><a href="pairing_heap_tag.html"><span class=
81 "c2"><tt>pairing_heap_tag</tt></span></a></td>
87 <a name="Allocator35940069" id=
88 "Allocator35940069"><b>class</b> Allocator </a>
93 <p>Allocator type.</p>
98 std::allocator<<b>char</b>>
104 <h2><a name="link2" id="link2">Public Types and
107 <h3><a name="link3" id="link3">General Container
110 <table class="c1" width="100%" border="1" summary="Types">
112 <td width="30%" align="left"><b>Type</b></td>
114 <td width="55%" align="left"><b>Definition</b></td>
116 <td width="15%" align="left"><b>Description</b></td>
122 <a name="size_type55424436" id="size_type55424436">size_type</a>
128 <b>typename</b> <a href=
129 "#Allocator35940069"><tt>Allocator</tt></a>::size_type
141 <a name="difference_type868028452" id=
142 "difference_type868028452">difference_type</a>
148 <b>typename</b> <a href=
149 "#Allocator35940069"><tt>Allocator</tt></a>::difference_type
154 <p>Difference type.</p>
159 <h3><a name="link4" id="link4">Categories</a></h3>
161 <table class="c1" width="100%" border="1" summary="Types">
163 <td width="30%" align="left"><b>Type</b></td>
165 <td width="55%" align="left"><b>Definition</b></td>
167 <td width="15%" align="left"><b>Description</b></td>
173 <a name="container_category1247973216" id=
174 "container_category1247973216">container_category</a>
180 <a href="#Tag278938"><tt>Tag</tt></a>
185 <p>The underlying mapped-structure tag of the
188 <p>This is one of:</p>
191 <li><a href="binary_heap_tag.html"><span class=
192 "c2"><tt>binary_heap_tag</tt></span></a></li>
194 <li><a href="binomial_heap_tag.html"><span class=
195 "c2"><tt>binomial_heap_tag</tt></span></a></li>
197 <li><a href="rc_binomial_heap_tag.html"><span class=
198 "c2"><tt>rc_binomial_heap_tag</tt></span></a></li>
200 <li><a href="pairing_heap_tag.html"><span class=
201 "c2"><tt>pairing_heap_tag</tt></span></a></li>
203 <li><a href="thin_heap_tag.html"><span class=
204 "c2"><tt>thin_heap_tag</tt></span></a></li>
210 <h3><a name="link5" id="link5">Policy Definitions</a></h3>
212 <table class="c1" width="100%" border="1" summary="Types">
214 <td width="30%" align="left"><b>Type</b></td>
216 <td width="55%" align="left"><b>Definition</b></td>
218 <td width="15%" align="left"><b>Description</b></td>
224 <a name="cmp_fn394495" id="cmp_fn394495">cmp_fn</a>
230 <a href="#Cmp_Fn294335"><tt>Cmp_Fn</tt></a>
235 <p>Comparison functor type.</p>
242 <a name="allocator48440069" id="allocator48440069">allocator</a>
248 <a href="#Allocator35940069"><tt>Allocator</tt></a>
253 <p><a href="#Allocator35940069"><tt>Allocator</tt></a>
259 <h3><a name="link6" id="link6">Value-Type Definitions</a></h3>
261 <table class="c1" width="100%" border="1" summary="Types">
263 <td width="30%" align="left"><b>Type</b></td>
265 <td width="55%" align="left"><b>Definition</b></td>
267 <td width="15%" align="left"><b>Description</b></td>
273 <a name="value_type279018186" id=
274 "value_type279018186">value_type</a>
280 <a href="#Value_Type216514186"><tt>Value_Type</tt></a>
292 <a name="reference54418471" id="reference54418471">reference</a>
298 <b>typename</b> <a href=
299 "#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind<
301 "#value_type279018186"><tt>value_type</tt></a>>::other::reference
306 <p>Value reference type.</p>
313 <a name="const_reference495461441" id=
314 "const_reference495461441">const_reference</a>
320 <b>typename</b> <a href=
321 "#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind<
323 "#value_type279018186"><tt>value_type</tt></a>>::other::const_reference
328 <p>Const value <a href=
329 "#reference54418471"><tt>reference</tt></a> type.</p>
336 <a name="pointer2179769" id="pointer2179769">pointer</a>
342 <b>typename</b> <a href=
343 "#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind<
345 "#value_type279018186"><tt>value_type</tt></a>>::other::pointer
350 <p>Value pointer type.</p>
357 <a name="const_pointer878814947" id=
358 "const_pointer878814947">const_pointer</a>
364 <b>typename</b> <a href=
365 "#allocator48440069"><tt>allocator</tt></a>::<b>template</b> rebind<
367 "#value_type279018186"><tt>value_type</tt></a>>::other::const_pointer
372 <p>Const Value <a href=
373 "#pointer2179769"><tt>pointer</tt></a> type.</p>
378 <h3><a name="link7" id="link7">Iterator Definitions</a></h3>
380 <table class="c1" width="100%" border="1" summary="Types">
382 <td width="30%" align="left"><b>Type</b></td>
384 <td width="55%" align="left"><b>Definition</b></td>
386 <td width="15%" align="left"><b>Description</b></td>
392 <a name="const_point_iterator2364676009" id=
393 "const_point_iterator2364676009">const_point_iterator</a>
399 Const point-type iterator.
404 <p>Const point-type iterator.</p>
411 <a name="point_iterator2789896775" id=
412 "point_iterator2789896775">point_iterator</a>
423 <p>Point-type iterator.</p>
430 <a name="const_iterator98626788" id=
431 "const_iterator98626788">const_iterator</a>
437 Const range-type iterator.
442 <p>Const range-type iterator.</p>
449 <a name="iterator10418194" id="iterator10418194">iterator</a>
460 <p>Range-type iterator.</p>
465 <h2><a name="link8" id="link8">Public Methods</a></h2>
467 <h3><a name="link9" id="link9">Constructors, Destructor, and
470 <table class="c1" width="100%" border="1" summary="Methods">
472 <td width="45%" align="left"><b>Method</b></td>
474 <td width="55%" align="left"><b>Description</b></td>
486 <p>Default constructor.</p>
494 (<b>const</b> <a href=
495 "#cmp_fn394495"><tt>cmp_fn</tt></a> &r_cmp_fn)
500 <p>Constructor taking some policy objects. <span class=
501 "c1"><tt>r_cmp_fn</tt></span> will be copied by the
502 <a href="#Cmp_Fn294335"><tt>Cmp_Fn</tt></a> object of the
503 container object.</p>
519 <p>Constructor taking iterators to a range of <a href=
520 "#value_type279018186"><tt>value_type</tt></a>s. The
521 <a href="#value_type279018186"><tt>value_type</tt></a>s
522 between <span class="c1"><tt>first_it</tt></span> and
523 <span class="c1"><tt>last_it</tt></span> will be inserted
524 into the container object.</p>
536 <b>const</b> <a href=
537 "#cmp_fn394495"><tt>cmp_fn</tt></a> &r_cmp_fn)
542 <p>Constructor taking iterators to a range of <a href=
543 "#value_type279018186"><tt>value_type</tt></a>s and some
544 policy objects The <a href=
545 "#value_type279018186"><tt>value_type</tt></a>s between
546 <span class="c1"><tt>first_it</tt></span> and
547 <span class="c1"><tt>last_it</tt></span> will be inserted
548 into the container object. <span class=
549 "c1"><tt>r_cmp_fn</tt></span> will be copied by the
550 <a href="#cmp_fn394495"><tt>cmp_fn</tt></a> object of the
551 container object.</p>
559 (<b>const</b> <span class=
560 "c2"><tt>priority_queue</tt></span> &other)
565 <p>Copy constructor.</p>
586 <span class="c2"><tt>priority_queue</tt></span> &
588 (<b>const</b> <span class=
589 "c2"><tt>priority_queue</tt></span> &other)
594 <p>Assignment operator.</p>
603 (<span class="c2"><tt>priority_queue</tt></span> &other)
608 <p>Swaps content.</p>
613 <h3><a name="link10" id="link10">Information Methods</a></h3>
615 <table class="c1" width="100%" border="1" summary="Methods">
617 <td width="45%" align="left"><b>Method</b></td>
619 <td width="55%" align="left"><b>Description</b></td>
625 <b>inline</b> <a href="#size_type55424436"><tt>size_type</tt></a>
632 <p>Returns the number of distinct <a href=
633 "#value_type279018186"><tt>value_type</tt></a> objects
634 the container object is storing.</p>
641 <b>inline</b> <a href="#size_type55424436"><tt>size_type</tt></a>
648 <p>Returns an upper bound on the number of distinct
649 <a href="#value_type279018186"><tt>value_type</tt></a>
650 objects this container can store.</p>
657 <b>inline</b> <b>bool</b>
664 <p>Returns whether the container object is not storing
666 "#value_type279018186"><tt>value_type</tt></a>
672 <h3><a name="link11" id="link11">Insert Methods</a></h3>
674 <table class="c1" width="100%" border="1" summary="Methods">
676 <td width="45%" align="left"><b>Method</b></td>
678 <td width="55%" align="left"><b>Description</b></td>
684 <b>inline</b> <a href=
685 "#point_iterator2789896775"><tt>point_iterator</tt></a>
688 "#const_reference495461441"><tt>const_reference</tt></a> r_val)
693 <p>Inserts a <a href=
694 "#value_type279018186"><tt>value_type</tt></a> object.
696 "#point_iterator2789896775"><tt>point_iterator</tt></a>
697 object associated with the new pushed <span class=
698 "c1"><tt>r_val</tt></span>.</p>
703 <h3><a name="link12" id="link12">Find Methods</a></h3>
705 <table class="c1" width="100%" border="1" summary="Methods">
707 <td width="45%" align="left"><b>Method</b></td>
709 <td width="55%" align="left"><b>Description</b></td>
715 <b>inline</b> <a href=
716 "#const_reference495461441"><tt>const_reference</tt></a>
723 <p>Returns the <a href=
724 "#const_reference495461441"><tt>const_reference</tt></a>
725 of the largest <a href=
726 "#value_type279018186"><tt>value_type</tt></a> in the
727 container object, i.e., a <a href=
728 "#value_type279018186"><tt>value_type</tt></a> v_max for
729 which any other <a href=
730 "#value_type279018186"><tt>value_type</tt></a> v in the
731 container object will satisfy !<a href=
732 "#cmp_fn394495"><tt>cmp_fn</tt></a>()(v_max, v).</p>
737 <h3><a name="link13" id="link13">Modify Methods</a></h3>
739 <table class="c1" width="100%" border="1" summary="Methods">
741 <td width="45%" align="left"><b>Method</b></td>
743 <td width="55%" align="left"><b>Description</b></td>
749 <b>inline</b> <b>void</b>
752 "#point_iterator2789896775"><tt>point_iterator</tt></a> it,
754 "#const_reference495461441"><tt>const_reference</tt></a> r_new_val)
759 <p>Modifies the <a href=
760 "#value_type279018186"><tt>value_type</tt></a> associated
762 "#point_iterator2789896775"><tt>point_iterator</tt></a>
763 <span class="c1"><tt>it</tt></span> into <span class=
764 "c1"><tt>r_new_val</tt></span>.</p>
766 <p>To use this method, <a href=
767 "#value_type279018186"><tt>value_type</tt></a> must be
773 <h3><a name="link14" id="link14">Erase Methods</a></h3>
775 <table class="c1" width="100%" border="1" summary="Methods">
777 <td width="45%" align="left"><b>Method</b></td>
779 <td width="55%" align="left"><b>Description</b></td>
785 <b>inline</b> <b>void</b>
792 <p>Pops the largest <a href=
793 "#value_type279018186"><tt>value_type</tt></a>.</p>
795 <p>If the container object is empty, results are
803 <b>inline</b> <b>void</b>
806 "#point_iterator2789896775"><tt>point_iterator</tt></a> it)
811 <p>Erases the <a href=
812 "#value_type279018186"><tt>value_type</tt></a> associated
814 "#point_iterator2789896775"><tt>point_iterator</tt></a>
815 <span class="c1"><tt>it</tt></span>.</p>
823 <b>class</b> Pred>
824 <b>inline</b> <a href="#size_type55424436"><tt>size_type</tt></a>
831 <p>Erases any <a href=
832 "#value_type279018186"><tt>value_type</tt></a> satisfying
833 the predicate <span class="c1"><tt>prd</tt></span>;
834 returns the number of <a href=
835 "#value_type279018186"><tt>value_type</tt></a>s
850 <p>Clears the container object.</p>
855 <h3><a name="link15" id="link15">Split and join
858 <table class="c1" width="100%" border="1" summary="Methods">
860 <td width="45%" align="left"><b>Method</b></td>
862 <td width="55%" align="left"><b>Description</b></td>
870 (<span class="c2"><tt>priority_queue</tt></span> &other)
875 <p>Joins two container objects. When this function
876 returns, <span class="c1"><tt>other</tt></span> will be
879 <p>When calling this method, <span class=
880 "c1"><tt>other</tt></span>'s policies must be
881 equivalent to this object's policies.</p>
889 <b>class</b> Pred>
890 <b>inline</b> <b>void</b>
893 <span class="c2"><tt>priority_queue</tt></span> &other)
898 <p>Splits into two container objects. When this function
899 returns, <span class="c1"><tt>other</tt></span> will be
900 contain only values v for which <span class=
901 "c1"><tt>prd</tt></span>(v) is <tt><b>true</b></tt>.</p>
903 <p>When calling this method, <span class=
904 "c1"><tt>other</tt></span>'s policies must be
905 equivalent to this object's policies.</p>
910 <h3><a name="link16" id="link16">Iteration Methods</a></h3>
912 <table class="c1" width="100%" border="1" summary="Methods">
914 <td width="45%" align="left"><b>Method</b></td>
916 <td width="55%" align="left"><b>Description</b></td>
922 <b>inline</b> <a href="#iterator10418194"><tt>iterator</tt></a>
929 <p>Returns an <a href=
930 "#iterator10418194"><tt>iterator</tt></a> corresponding
931 to the first <a href=
932 "#value_type279018186"><tt>value_type</tt></a> in the
940 <b>inline</b> <a href=
941 "#const_iterator98626788"><tt>const_iterator</tt></a>
948 <p>Returns a <a href=
949 "#const_iterator98626788"><tt>const_iterator</tt></a>
950 corresponding to the first <a href=
951 "#value_type279018186"><tt>value_type</tt></a> in the
959 <b>inline</b> <a href="#iterator10418194"><tt>iterator</tt></a>
966 <p>Returns an <a href=
967 "#iterator10418194"><tt>iterator</tt></a> corresponding
968 to the just-after-last <a href=
969 "#value_type279018186"><tt>value_type</tt></a> in the
977 <b>inline</b> <a href=
978 "#const_iterator98626788"><tt>const_iterator</tt></a>
985 <p>Returns a <a href=
986 "#const_iterator98626788"><tt>const_iterator</tt></a>
987 corresponding to the just-after-last <a href=
988 "#value_type279018186"><tt>value_type</tt></a> in the