14template <
typename Iterator,
typename Compare>
15void sift_down(Iterator first, Iterator last, Iterator start, Compare comp) {
17 auto child = first + 2 * (root - first) + 1;
19 while (child < last) {
20 if (child + 1 < last && comp(*child, *(child + 1))) {
24 if (comp(*root, *child)) {
30 child = first + 2 * (root - first) + 1;
37template <
typename Iterator,
typename Compare>
38void push_heap(Iterator first, Iterator last, Compare comp) {
40 auto parent = first + ((
pos - first) - 1) / 2;
42 while (
pos > first && comp(*parent, *
pos)) {
48 parent = first + ((
pos - first) - 1) / 2;
52template <
typename Iterator>
void push_heap(Iterator first, Iterator last) {
54 push_heap(first, last, [](
const value_type &a,
const value_type &b) {
return a < b; });
57template <
typename Iterator,
typename Compare>
58void pop_heap(Iterator first, Iterator last, Compare comp) {
67template <
typename Iterator>
void pop_heap(Iterator first, Iterator last) {
69 pop_heap(first, last, [](
const value_type &a,
const value_type &b) {
return a < b; });
72template <
typename T,
typename Compare = fl::less<T>,
73 typename VectorT = vector<T>>
95 template<
typename... Args>
179template<
typename T,
typename Compare = fl::less<T>>
212 template<
typename... Args>
233 return mQueue.top().mValue;
PriorityQueue(const Compare &comp)
memory_resource * get_memory_resource() const
bool operator<=(const PriorityQueue &other) const
Less-than-or-equal comparison.
bool operator>=(const PriorityQueue &other) const
Greater-than-or-equal comparison.
PriorityQueue(const Compare &comp, memory_resource *resource)
PriorityQueue() FL_NOEXCEPT=default
bool operator>(const PriorityQueue &other) const
Greater-than comparison.
void emplace(Args &&... args)
bool operator==(const PriorityQueue &other) const
Equality comparison.
bool operator!=(const PriorityQueue &other) const
Inequality comparison.
const Compare & compare() const
bool operator<(const PriorityQueue &other) const
Lexicographic comparison.
void push(const T &value)
Polymorphic memory resource base class (PMR-style).
bool operator<=(const priority_queue_stable &other) const
Less-than-or-equal comparison.
void pop()
Remove the top element from the queue.
bool empty() const
Check if the queue is empty.
fl::PriorityQueue< StableElement > mQueue
void push(const T &value)
Push an element into the priority queue.
fl::size size() const
Get the number of elements in the queue.
bool operator==(const priority_queue_stable &other) const
Equality comparison.
priority_queue_stable() FL_NOEXCEPT
bool operator<(const priority_queue_stable &other) const
Lexicographic comparison.
bool operator>=(const priority_queue_stable &other) const
Greater-than-or-equal comparison.
const T & top() const
Access the top element (highest priority)
void clear()
Clear all elements from the queue.
void emplace(Args &&... args)
bool operator>(const priority_queue_stable &other) const
Greater-than comparison.
bool operator!=(const priority_queue_stable &other) const
Inequality comparison.
PMR-style polymorphic memory resource for type-erased allocation.
constexpr T && forward(typename remove_reference< T >::type &t) FL_NOEXCEPT
constexpr remove_reference< T >::type && move(T &&t) FL_NOEXCEPT
constexpr int type_rank< T >::value
void sift_down(Iterator first, Iterator last, Iterator start, Compare comp)
void pop_heap(Iterator first, Iterator last, Compare comp)
void push_heap(Iterator first, Iterator last, Compare comp)
Base definition for an LED controller.
bool operator<(const StableElement &other) const