CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
PriorityQueue< T, P > Class Template Reference

Priority queue data container. More...

#include <cc/PriorityQueue>

Public Types

using Item = T
 Item type.
 
using Priority = P
 Priority type.
 

Standard Iterators

using value_type = Item
 Item value type.
 
using size_type = long
 Type of the container capacity.
 
using const_iterator = Iterator<const PriorityQueue>
 Readonly value iterator.
 
using const_reverse_iterator = ReverseIterator<const PriorityQueue>
 Readonly reverse value iterator.
 
const_iterator begin () const
 Return readonly iterator pointing to the first item (if any)
 
const_iterator cbegin () const
 Return readonly iterator pointing to the first item (if any)
 
const_iterator end () const
 Return readonly iterator pointing behind the last item
 
const_iterator cend () const
 Return readonly iterator pointing behind the last item
 
const_reverse_iterator rbegin () const
 Return readonly reverse iterator pointing to the last item (if any)
 
const_reverse_iterator crbegin () const
 Return readonly reverse iterator pointing to the last item (if any)
 
const_reverse_iterator rend () const
 Return reverse iterator pointing before the first item
 
const_reverse_iterator crend () const
 Return reverse iterator pointing before the first item
 

Construction and Assignment

 PriorityQueue ()=default
 Construct an empty queue.
 
 PriorityQueue (const PriorityQueue &other)=default
 Construct a copy of other.
 
 PriorityQueue (std::initializer_list< Item > items)
 Construct with initial items.
 

Item Access

long count () const
 Get the number of items stored in the priority queue.
 
Item at (Locator pos) const
 Get item at position pos.
 

Priority-Queue Operations

Locator head () const
 Get a locator pointing to the first item.
 
Locator tail () const
 Get a locator pointing to the last item.
 
void pushBack (const Item &item, Priority priority=Priority{})
 Append item to the queue.
 
void popFront (Out< Item > item=None{})
 Remove and return the first of the highest priority items.
 
void operator<< (const Item &item)
 Append item to the end of the queue.
 
void operator>> (Item &item)
 Remove and return item from the front of the queue.
 

Comparism Operators

template<class Other >
bool operator== (const Other &other) const
 Equality operator.
 

Detailed Description

template<class T, class P = int>
class cc::PriorityQueue< T, P >

Priority queue data container.

Template Parameters
TItem type
PPriority type

Member Typedef Documentation

◆ Item

template<class T , class P = int>
using Item = T

Item type.

◆ Priority

template<class T , class P = int>
using Priority = P

Priority type.

◆ value_type

template<class T , class P = int>
using value_type = Item

Item value type.

◆ size_type

template<class T , class P = int>
using size_type = long

Type of the container capacity.

◆ const_iterator

template<class T , class P = int>
using const_iterator = Iterator<const PriorityQueue>

Readonly value iterator.

◆ const_reverse_iterator

template<class T , class P = int>
using const_reverse_iterator = ReverseIterator<const PriorityQueue>

Readonly reverse value iterator.

Constructor & Destructor Documentation

◆ PriorityQueue() [1/3]

template<class T , class P = int>
PriorityQueue ( )
default

Construct an empty queue.

◆ PriorityQueue() [2/3]

template<class T , class P = int>
PriorityQueue ( const PriorityQueue< T, P > & other)
default

Construct a copy of other.

◆ PriorityQueue() [3/3]

template<class T , class P = int>
PriorityQueue ( std::initializer_list< Item > items)

Construct with initial items.

Member Function Documentation

◆ count()

template<class T , class P = int>
long count ( ) const

Get the number of items stored in the priority queue.

◆ at()

template<class T , class P = int>
Item at ( Locator pos) const

Get item at position pos.

◆ head()

template<class T , class P = int>
Locator head ( ) const

Get a locator pointing to the first item.

◆ tail()

template<class T , class P = int>
Locator tail ( ) const

Get a locator pointing to the last item.

◆ pushBack()

template<class T , class P = int>
void pushBack ( const Item & item,
Priority priority = Priority{} )

Append item to the queue.

◆ popFront()

template<class T , class P = int>
void popFront ( Out< Item > item = None{})

Remove and return the first of the highest priority items.

◆ operator<<()

template<class T , class P = int>
void operator<< ( const Item & item)

Append item to the end of the queue.

◆ operator>>()

template<class T , class P = int>
void operator>> ( Item & item)

Remove and return item from the front of the queue.

◆ begin()

template<class T , class P = int>
const_iterator begin ( ) const

Return readonly iterator pointing to the first item (if any)

◆ cbegin()

template<class T , class P = int>
const_iterator cbegin ( ) const

Return readonly iterator pointing to the first item (if any)

◆ end()

template<class T , class P = int>
const_iterator end ( ) const

Return readonly iterator pointing behind the last item

◆ cend()

template<class T , class P = int>
const_iterator cend ( ) const

Return readonly iterator pointing behind the last item

◆ rbegin()

template<class T , class P = int>
const_reverse_iterator rbegin ( ) const

Return readonly reverse iterator pointing to the last item (if any)

◆ crbegin()

template<class T , class P = int>
const_reverse_iterator crbegin ( ) const

Return readonly reverse iterator pointing to the last item (if any)

◆ rend()

template<class T , class P = int>
const_reverse_iterator rend ( ) const

Return reverse iterator pointing before the first item

◆ crend()

template<class T , class P = int>
const_reverse_iterator crend ( ) const

Return reverse iterator pointing before the first item

◆ operator==()

template<class T , class P = int>
template<class Other >
bool operator== ( const Other & other) const

Equality operator.