15#include "../defines.h"
16#include "./iteratorUtils.h"
83 template <
class T,
int N,
class CompareT = std::less<T>>
86 static_assert(
N > 0,
"The capacity must be strictly positive");
90 using container_type = std::array<T, N>;
92 using iterator =
typename container_type::iterator;
93 using const_iterator =
typename container_type::const_iterator;
101 template <
class InputIt>
110 PONCA_MULTIARCH [[
nodiscard]]
inline iterator begin();
111 PONCA_MULTIARCH [[
nodiscard]]
inline const_iterator begin()
const;
112 PONCA_MULTIARCH [[
nodiscard]]
inline const_iterator cbegin()
const;
114 PONCA_MULTIARCH [[
nodiscard]]
inline iterator end();
115 PONCA_MULTIARCH [[
nodiscard]]
inline const_iterator end()
const;
116 PONCA_MULTIARCH [[
nodiscard]]
inline const_iterator cend()
const;
120 PONCA_MULTIARCH [[
nodiscard]]
inline const T& top()
const;
121 PONCA_MULTIARCH [[
nodiscard]]
inline const T& bottom()
const;
123 PONCA_MULTIARCH [[
nodiscard]]
inline T& top();
124 PONCA_MULTIARCH [[
nodiscard]]
inline T& bottom();
128 PONCA_MULTIARCH [[
nodiscard]]
inline bool empty()
const;
129 PONCA_MULTIARCH [[
nodiscard]]
inline bool full()
const;
130 PONCA_MULTIARCH [[
nodiscard]]
inline size_t size()
const;
131 PONCA_MULTIARCH [[
nodiscard]]
inline size_t capacity()
const;
135 PONCA_MULTIARCH
inline bool pushImpl(
const T&
_value, T**
_addr);
138 PONCA_MULTIARCH
bool push(T&&
_value);
139 PONCA_MULTIARCH
bool push(
const T&
_value);
140 PONCA_MULTIARCH
void pop();
141 PONCA_MULTIARCH
void reserve(
int _capacity);
142 PONCA_MULTIARCH
void clear();
146 PONCA_MULTIARCH
const container_type& container()
const;
149 container_type m_data{};
162 template <
class T,
int N,
class Cmp>
163 PONCA_MULTIARCH LimitedPriorityQueue<T, N, Cmp>::LimitedPriorityQueue() : m_comp()
168 template <
class T,
int N,
class Cmp>
169 PONCA_MULTIARCH LimitedPriorityQueue<T, N, Cmp>::LimitedPriorityQueue(
const Self& other)
170 : m_data(other.m_data), m_comp(other.m_comp), m_size(other.m_size), m_capacity(other.m_capacity)
175 template <
class T,
int N,
class Cmp>
176 PONCA_MULTIARCH LimitedPriorityQueue<T, N, Cmp>::LimitedPriorityQueue(
const int capacity)
177 : m_comp(), m_capacity(capacity)
179 PONCA_ASSERT((capacity >= 0));
180 PONCA_ASSERT((capacity <= N));
183 template <
class T,
int N,
class Cmp>
184 template <
class InputIt>
185 PONCA_MULTIARCH LimitedPriorityQueue<T, N, Cmp>::LimitedPriorityQueue(
const int capacity, InputIt first,
187 : m_comp(), m_capacity(capacity)
189 for (InputIt it = first; it < last; ++it)
193 PONCA_ASSERT((capacity >= 0));
194 PONCA_ASSERT((capacity <= N));
198#include "limitedPriorityQueue.hpp"
Aggregator class used to declare specialized structures using CRTP.
The LimitedPriorityQueue class is similar to std::priority_queue but has a limited capacity and handl...
size_t m_capacity
The capacity of the limited queue.
size_t m_size
The current size of the Queue.
This Source Code Form is subject to the terms of the Mozilla Public License, v.