34#ifndef __ADS_ListPriorityQueue
35 #define __ADS_ListPriorityQueue
63template<
class T , std::totally_ordered P =
int ,
bool Sorted = true >
67 using Pair = std::pair< P , T >;
76 [[nodiscard]]
bool empty(
void )
const;
79 [[nodiscard]]
int size(
void )
const;
95 [[nodiscard]]
const T &
min(
void )
const;
185 [[nodiscard]]
Handle first(
void )
const;
188 [[nodiscard]]
Handle after(
const P & p )
const;
191 [[nodiscard]]
bool owns(
Handle y )
const;
194 [[nodiscard]]
bool consistent(
void )
const;
209#include "ADS/priority/impl/ListPriorityQueue.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The LIST of the book: a SEQUENCE [see ADT.h] realized as a bidirectional circular list of cells with ...
The PRIORITYQUEUE of section 10.1, with decreasing priority, in two concepts.
a priority queue on a list, sorted by priority if Sorted, unsorted otherwise
Definition ListPriorityQueue.h:65
const_iterator cend(void) const
the same as end()
Definition ListPriorityQueue.h:180
const Pair & const_reference
the type of a constant reference to an item
Definition ListPriorityQueue.h:167
void decrease(Handle &y, const P &p)
lowers to the priority of the item of the handle , which stays valid, in time if sorted and otherw...
std::ptrdiff_t difference_type
the type of the distances between iterators
Definition ListPriorityQueue.h:163
T deleteMin(void)
removes the item of smallest priority and returns it, in time if sorted and otherwise
Pair value_type
the type of the items of the view
Definition ListPriorityQueue.h:159
typename List< Pair >::const_iterator const_iterator
the iterator of the view, constant
Definition ListPriorityQueue.h:171
T Item
the type of the items
Definition ListPriorityQueue.h:71
typename List< Pair >::const_iterator iterator
the same as const_iterator
Definition ListPriorityQueue.h:169
const_iterator end(void) const
the end of the view
Definition ListPriorityQueue.h:176
const_iterator begin(void) const
the first item of the view
Definition ListPriorityQueue.h:174
const T & min(void) const
the item of smallest priority, in time if sorted and otherwise
P Priority
the type of priorities
Definition ListPriorityQueue.h:72
const_iterator cbegin(void) const
the same as begin()
Definition ListPriorityQueue.h:178
bool empty(void) const
whether the queue has no item
typename List< Pair >::Pos Handle
the cell of an item
Definition ListPriorityQueue.h:73
int size(void) const
the number of items,
Handle insert(const T &x, const P &p)
inserts with the priority and gives its handle, in time if sorted and otherwise
const Pair & reference
the type of a reference to an item of the view
Definition ListPriorityQueue.h:165
std::size_t size_type
the type of the sizes
Definition ListPriorityQueue.h:161
Iterator< true > const_iterator
the iterator on the constant items
Definition List.h:324
Cell * Pos
a position is the address of a cell
Definition List.h:132