1#ifndef _PRIORITYLIST_H_
2#define _PRIORITYLIST_H_
4#include <Utility/List.hpp>
5#include <Utility/Pair.hpp>
40 void insert(
const T& element,
int priority) {
43 while (index < data.GetSize() && data[index].second > priority) {
46 data.insert(index, std::make_pair(element, priority));
56 if (data.GetSize() == 0) {
57 throw std::runtime_error(
"Priority list is empty");
68 if (data.GetSize() == 0) {
69 throw std::runtime_error(
"Priority list is empty");
Implements a dynamic array-like list for storing and managing a collection of elements.
A simple container for storing two values as a pair.
A list where elements are stored with associated priorities.
void removeHighestPriorityElement()
Removes the element with the highest priority.
T getHighestPriorityElement() const
Returns the element with the highest priority.
void insert(const T &element, int priority)
Inserts an element with the given priority.
Root namespace for everything the engine exposes.