|
FastLED 3.9.15
|
Stable priority queue that maintains FIFO ordering for equal-priority elements.
This is a wrapper around fl::PriorityQueue that adds a monotonic sequence counter to ensure stable (FIFO) ordering when elements have equal priority according to the comparison function.
Template Parameters:
By default, this creates a MAX-HEAP (largest element has highest priority). For custom types with special priority ordering, define operator< and use fl::greater<T>:
Example (default max-heap for integers):
Definition at line 180 of file priority_queue.h.
#include <priority_queue.h>
Inheritance diagram for fl::priority_queue_stable< T, Compare >:
Collaboration diagram for fl::priority_queue_stable< T, Compare >:Classes | |
| struct | StableElement |
Public Types | |
| using | size_type = fl::size |
| using | value_type = T |
Public Member Functions | |
| priority_queue_stable () FL_NOEXCEPT | |
| void | clear () |
| Clear all elements from the queue. | |
| template<typename... Args> | |
| void | emplace (Args &&... args) |
| bool | empty () const |
| Check if the queue is empty. | |
| bool | operator!= (const priority_queue_stable &other) const |
| Inequality comparison. | |
| bool | operator< (const priority_queue_stable &other) const |
| Lexicographic comparison. | |
| bool | operator<= (const priority_queue_stable &other) const |
| Less-than-or-equal comparison. | |
| bool | operator== (const priority_queue_stable &other) const |
| Equality comparison. | |
| bool | operator> (const priority_queue_stable &other) const |
| Greater-than comparison. | |
| bool | operator>= (const priority_queue_stable &other) const |
| Greater-than-or-equal comparison. | |
| void | pop () |
| Remove the top element from the queue. | |
| void | push (const T &value) |
| Push an element into the priority queue. | |
| fl::size | size () const |
| Get the number of elements in the queue. | |
| const T & | top () const |
| Access the top element (highest priority) | |
Private Attributes | |
| u64 | mNextSequence |
| fl::PriorityQueue< StableElement > | mQueue |