|
ADS
Algorithms and Data Structures
|
The access to the priority queues of the two concepts of section 10.1, whose definitions are in PriorityQueue.h, beyond the book. More...
Files | |
| file | ADS/priority/QueueCustomization.h |
| The access to the priority queues of the two concepts of section 10.1, whose definitions are in PriorityQueue.h [see PriorityQueue.h, which includes this header], beyond the book: the items of a queue, queue_item_t< Q >, and the operations by which a queue of ADS, of the standard library or of another library is read alike. | |
Typedefs | |
| template<class Q> | |
| using | ADS::queue_item_t = typename detail::queue_item< Q >::type |
| the items of the queue Q: Q::Item, else Q::value_type | |
| template<class Q> | |
| using | ADS::queue_handle_t = typename detail::queue_handle< Q >::type |
| the handles of the queue Q, which its insertions return: Q::Handle, else Q::handle_type (the mutable heaps of Boost.Heap) | |
Variables | |
| constexpr detail::QueueMin | ADS::queue_min {} |
| the item of smallest priority of \( q \): q.min(), else queue_min( q ) found by ADL, else q.top() | |
| constexpr detail::QueueDeleteMin | ADS::queue_deleteMin {} |
| the item of smallest priority of \( q \), removed: q.deleteMin(), else queue_deleteMin( q ) found by ADL, else q.pop() if it returns the item, else q.top() and then q.pop() | |
| constexpr detail::QueueInsert | ADS::queue_insert {} |
| \( x \) inserted in \( q \) with the keys \( a \) of its order: q.insert( x , a... ), else queue_insert( q , x , a... ) found by ADL, else q.push( x , a... ) | |
| constexpr detail::QueueDecrease | ADS::queue_decrease {} |
| the priority of the item of the handle \( h \) of \( q \) lowered to \( p \), i.e., the item moved toward the minimum: q.decrease( h ,
p ) if Q declares a Handle, the handles of the book, else queue_decrease( q , h , p ) found by ADL. | |
The access to the priority queues of the two concepts of section 10.1, whose definitions are in PriorityQueue.h, beyond the book.
The definitions, the invariants and the costs of the area are in Theory of priority queues.
| using ADS::queue_handle_t = typename detail::queue_handle< Q >::type |
the handles of the queue Q, which its insertions return: Q::Handle, else Q::handle_type (the mutable heaps of Boost.Heap)
| using ADS::queue_item_t = typename detail::queue_item< Q >::type |
the items of the queue Q: Q::Item, else Q::value_type
|
inlineconstexpr |
the priority of the item of the handle \( h \) of \( q \) lowered to \( p \), i.e., the item moved toward the minimum: q.decrease( h , p ) if Q declares a Handle, the handles of the book, else queue_decrease( q , h , p ) found by ADL.
There is no step on the spelling of another library, since the names disagree on the direction: Boost.Heap calls increase() the move toward the top of its heap, and ADS/interop/boost/Heap.h gives the free function that says so
|
inlineconstexpr |
the item of smallest priority of \( q \), removed: q.deleteMin(), else queue_deleteMin( q ) found by ADL, else q.pop() if it returns the item, else q.top() and then q.pop()
In pseudocode (the customization point of Niebler, beyond the book), each test made on the type of \( q \) when the call is compiled:
\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{deleteMin}( q ) \cr 2 & \quad \textbf{if}\ q.\mathrm{deleteMin}()\ \text{is well formed} \ \textbf{then}\ \textbf{return}\ q.\mathrm{deleteMin}() \cr 3 & \quad \textbf{else if}\ \mathrm{queue\_deleteMin}( q )\ \text{is} \text{ found by ADL}\ \textbf{then} \cr 4 & \qquad \textbf{return}\ \mathrm{queue\_deleteMin}( q ) \cr 5 & \quad \textbf{else if}\ q.\mathrm{pop}()\ \text{returns an item} \ \textbf{then}\ \textbf{return}\ q.\mathrm{pop}() \cr 6 & \quad \textbf{else} \cr 7 & \qquad x \gets q.\mathrm{top}();\ q.\mathrm{pop}(); \ \textbf{return}\ x \end{array}} \]
|
inlineconstexpr |
\( x \) inserted in \( q \) with the keys \( a \) of its order: q.insert( x , a... ), else queue_insert( q , x , a... ) found by ADL, else q.push( x , a... )
|
inlineconstexpr |
the item of smallest priority of \( q \): q.min(), else queue_min( q ) found by ADL, else q.top()