11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
20PROMEKI_NAMESPACE_BEGIN
40template <
typename T,
typename Compare = std::less<T>>
class PriorityQueue {
43 PriorityQueue() =
default;
46 PriorityQueue(
const PriorityQueue &other) : d(other.d) {}
49 PriorityQueue(PriorityQueue &&other) noexcept : d(std::move(other.d)) {}
52 ~PriorityQueue() =
default;
55 PriorityQueue &operator=(
const PriorityQueue &other) {
61 PriorityQueue &operator=(PriorityQueue &&other)
noexcept {
62 d = std::move(other.d);
69 bool isEmpty()
const {
return d.empty(); }
72 size_t size()
const {
return d.size(); }
77 const T &top()
const {
return d.top(); }
85 void push(
const T &value) {
94 void push(T &&value) {
95 d.push(std::move(value));
105 if (d.empty())
throw std::logic_error(
"PriorityQueue::pop on empty queue");
115 void swap(PriorityQueue &other)
noexcept {
121 std::priority_queue<T, std::vector<T>, Compare> d;