The FixedPriorityQueue class provides a priority queue implementation with the standard O(log n) insertion, deletion, pop, and update operations, but in addition can perform non-modifying queries in O(1) time.
More...
#include <FixedPriorityQueue.hpp>
|
| | FixedPriorityQueue (V const max) |
| | Create a new priority queue that can hold element 0 through max. More...
|
| |
| void | remove (V const value) noexcept |
| | Remove an element from the queue. More...
|
| |
| void | add (K const key, V const value) noexcept |
| | Add an value to the queue. More...
|
| |
| void | update (K const key, V const value) noexcept |
| | Update the key associated with a given value. More...
|
| |
| void | updateByDelta (K const delta, V const value) noexcept |
| | Update the key associated with a given value by modifying the key. More...
|
| |
| bool | contains (V const value) const noexcept |
| | Check if a value in present in the priority queue. More...
|
| |
| K | get (V const value) const noexcept |
| | Get the key associated with the given value. More...
|
| |
| V | pop () noexcept |
| | Pop the top value from the queue. More...
|
| |
| V const & | peek () const noexcept |
| | Get get the top of the priority queue's value. More...
|
| |
| K const & | max () const noexcept |
| | Get get the top of the priority queue's value. More...
|
| |
| size_t | size () const noexcept |
| | Get the number of elements in the queue. More...
|
| |
|
void | clear () noexcept |
| | Clear entries from the priority queue.
|
| |
| ValueSet | remaining () const noexcept |
| | Get the set of remaining items in the priority. The order of the values is arbitrary. More...
|
| |
|
|
static constexpr size_t const | NULL_INDEX = static_cast<size_t>(-1) |
| |
template<typename K, typename V>
class sl::FixedPriorityQueue< K, V >
The FixedPriorityQueue class provides a priority queue implementation with the standard O(log n) insertion, deletion, pop, and update operations, but in addition can perform non-modifying queries in O(1) time.
- Template Parameters
-
| K | The key type. |
| V | The value type. |
◆ FixedPriorityQueue()
template<typename K, typename V>
Create a new priority queue that can hold element 0 through max.
- Parameters
-
| max | The max value in the priority queue (exclusive). |
◆ add()
template<typename K, typename V>
Add an value to the queue.
- Parameters
-
| key | The key/priority of the value to add. |
| value | The value to add. |
◆ contains()
template<typename K, typename V>
Check if a value in present in the priority queue.
- Parameters
-
| value | The value to check for. |
- Returns
- Whether or not the value is present.
◆ get()
template<typename K, typename V>
Get the key associated with the given value.
- Parameters
-
- Returns
- The key.
◆ max()
template<typename K, typename V>
Get get the top of the priority queue's value.
- Returns
- The value.
◆ peek()
template<typename K, typename V>
Get get the top of the priority queue's value.
- Returns
- The value.
◆ pop()
template<typename K, typename V>
Pop the top value from the queue.
- Returns
- The top value.
◆ remaining()
template<typename K, typename V>
Get the set of remaining items in the priority. The order of the values is arbitrary.
- Returns
- The set of values.
◆ remove()
template<typename K, typename V>
Remove an element from the queue.
- Parameters
-
| elem | The element to remove |
◆ size()
template<typename K, typename V>
Get the number of elements in the queue.
- Returns
- The number of elements.
◆ update()
template<typename K, typename V>
Update the key associated with a given value.
- Parameters
-
| key | The new key for the value. |
| value | The value. |
◆ updateByDelta()
template<typename K, typename V>
Update the key associated with a given value by modifying the key.
- Parameters
-
| delta | The change in priority. |
| value | The value. |
The documentation for this class was generated from the following file: