BoundedPriorityDeque
A lightweight, performant bounded priority deque with wide
|
Lightweight maximum priority dequeue. More...
#include <BoundedPriorityDeque.hpp>
Public Member Functions | |
BoundedMaxPriorityDeque (unsigned int capacity=0) | |
Public Member Functions inherited from BoundedPriorityDequeBase< K, V > | |
BoundedPriorityDequeBase (size_t capacity=0) | |
Primary constructor with default bounding capacity of zero. | |
BoundingPair< K, V > | top () const |
Get the highest-priority element. | |
BoundingPair< K, V > | bottom () const |
Get the lowest-priority element. | |
K | topK () const |
Get the key from the highest-priority element. | |
K | bottomK () const |
Get the key from the lowest-priority element. | |
void | emplace (K key, const V &value) |
constructs a BoundingPair<K, V> element and inserts it. | |
void | push (const BoundingPair< K, V > &element) |
Inserts an element into the vector. | |
BoundingPair< K, V > | operator[] (size_t offsetTop) const |
random accessor relative to the top of the deque. | |
BoundingPair< K, V > | pop () |
remove the highest-priority element. | |
BoundingPair< K, V > | popBottom () |
remove the lowest-priority element. | |
void | operator+= (const BoundedPriorityDequeBase< K, V > &rhs) |
Merges another BoundedPriorityDeque instance into the calling instance. | |
void | clear () |
clears and resets the data structure. | |
size_t | size () const |
size_t | capacity () const |
bool | empty () const |
bool | full () const |
void | resize (size_t k) |
Sets the capacity and restores clean state. | |
Protected Member Functions | |
bool | compare (K a, K b) const override |
Protected Member Functions inherited from BoundedPriorityDequeBase< K, V > | |
size_t | nextIndex (size_t current) const |
Provides fast access to the next index of a given insertion position. | |
size_t | prevIndex (size_t current) const |
Provides fast access to the previous index of a given insertion position. | |
size_t | binarySearch (const BoundingPair< K, V > &target) const |
Efficiently locates the optimal insertion index. | |
void | insert (const BoundingPair< K, V > &element) |
Inserts an element into the _buffer. | |
void | _popTop () |
Internal method with no return val. | |
void | _popBottom () |
Internal method with no return val. | |
Additional Inherited Members | |
Protected Attributes inherited from BoundedPriorityDequeBase< K, V > | |
std::vector< BoundingPair< K, V > > | _buffer |
size_t | _k |
size_t | _size = 0 |
size_t | _head = 0 |
size_t | _tail = 0 |
Lightweight maximum priority dequeue.
This class provides a lightweight maximum priority implement of the base class with an arithmetic key value.
K | Arithmetic type of the key. |
V | Type of the value. |
|
inlineoverrideprotectedvirtual |
Compares two keys.
a | The first key. |
b | The second key. |
Implements BoundedPriorityDequeBase< K, V >.