CS::Utility::PriorityQueue< T, Container, Comparator > Class Template Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
CS::Utility::PriorityQueue< T, Container, Comparator > Class Template Reference

An implementation of a priority queue. More...

`#include <csutil/priorityqueue.h>`

List of all members.

## Public Member Functions
template<typename T2 >
bool | Delete (const T2 &what)
| Remove largest item that is equal to what.
void | Insert (const T &what)
| Insert an item.
bool | IsEmpty () const
| Return whether items are still in the queue.
T | Pop ()
| Return and remove the largest item.
const T & | Top () const
| Return, but don't remove, the largest item.

## Detailed Description

### template<typename T, class Container = csArray<T>, class Comparator = csComparator<T, T>>
class CS::Utility::PriorityQueue< T, Container, Comparator >

An implementation of a priority queue.

T must be comparable with csComparator<>. Larger items are returned first.

Definition at line 40 of file priorityqueue.h.

## Member Function Documentation

template<typename T , class Container = csArray<T>, class Comparator = csComparator<T, T>>
template<typename T2 >

bool CS::Utility::PriorityQueue< T, Container, Comparator >::Delete | ( | const T2 & | what | ) | `[inline]`

Remove largest item that is equal to what.

The contained type T and the type T2 of what must be comparable with csComparator<>.

Returns:
  Whether item was found and deleted.

Remarks:
  Does a linear search - slow.

Definition at line 136 of file priorityqueue.h.

template<typename T , class Container = csArray<T>, class Comparator = csComparator<T, T>>

void CS::Utility::PriorityQueue< T, Container, Comparator >::Insert | ( | const T & | what | ) | `[inline]`

Insert an item.

Definition at line 104 of file priorityqueue.h.

template<typename T , class Container = csArray<T>, class Comparator = csComparator<T, T>>

bool CS::Utility::PriorityQueue< T, Container, Comparator >::IsEmpty | ( |  | ) | const`[inline]`

Return whether items are still in the queue.

Definition at line 151 of file priorityqueue.h.

template<typename T , class Container = csArray<T>, class Comparator = csComparator<T, T>>

T CS::Utility::PriorityQueue< T, Container, Comparator >::Pop | ( |  | ) | `[inline]`

Return and remove the largest item.

Definition at line 112 of file priorityqueue.h.

template<typename T , class Container = csArray<T>, class Comparator = csComparator<T, T>>

const T& CS::Utility::PriorityQueue< T, Container, Comparator >::Top | ( |  | ) | const`[inline]`

Return, but don't remove, the largest item.

Definition at line 123 of file priorityqueue.h.

The documentation for this class was generated from the following file:

- csutil/priorityqueue.h