ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
QueueCustomization.h File Reference

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. More...

#include <concepts>
#include <type_traits>
#include <utility>

Go to the source code of this file.

Namespaces

namespace  ADS

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.

Detailed description

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.

The base concept is read through three customization point objects, queue_insert(), queue_min() and queue_deleteMin(), in the form of Niebler: each calls the member of the book (insert(), min(), deleteMin()) if the queue has it, else a free function found by argument-dependent lookup (queue_min( q ) and the others), which is how a type that ADS does not own is adapted, else the spelling of the standard library (push(), top(), and pop(), which returns the item or, as in std::priority_queue, nothing after top()). The keys of an insertion are those of the order of the queue: a priority (Priority), one or two keys (Key), or none, when the items are ordered by themselves. The handles are read in the same way: queue_handle_t< Q > is Q::Handle, else the handle_type of the standard spelling, and queue_decrease( q , h , p ) calls q.decrease( h , p ) of a queue with Handle, else the free function found by ADL, so that a mutable queue of another library lowers its keys natively once such a function is given for it.

See also
E. Niebler, Suggested design for customization points, ISO/IEC JTC1 SC22 WG21 N4381, 2015, https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa