A binary heap priority queue for the data in an array. More...
#include <PriorityQueueBinaryHeapArray.h>
Public Types | |
typedef base_type::element_type | element_type |
The element type. | |
typedef base_type::const_reference | const_reference |
A const reference to the element type. | |
typedef base_type::key_type | key_type |
The key type. | |
typedef base_type::size_type | size_type |
The size type. | |
typedef base_type::value_type | value_type |
The type stored in the binary heap. | |
typedef base_type::iterator | iterator |
An iterator on the value type. | |
Public Member Functions | |
template<class DataArray > | |
PriorityQueueBinaryHeapArray (const DataArray &data_array, const sequence_type &container=sequence_type()) | |
Make from a container of values. | |
template<class DataArray > | |
PriorityQueueBinaryHeapArray (const DataArray &data_array, size_type n) | |
Construct and reserve memory for n elements. | |
template<class DataArray , class InputIterator > | |
PriorityQueueBinaryHeapArray (const DataArray &data_array, InputIterator first, InputIterator last, const sequence_type &container=sequence_type()) | |
Add the values in the range to the container then make the heap. | |
virtual | ~PriorityQueueBinaryHeapArray () |
Destructor. | |
Protected Attributes | |
heap_handle_array_type | _heap_handles |
The array of heap handles. |
A binary heap priority queue for the data in an array.
This priority queue is designed for storing handles into an array. It derives functionality from ads::PriorityQueueBinaryHeapDynamicKeys and thus supports dynamic keys. The element type is the only required parameter. The remaining parameters have default values. By default, it is assumed that the element type is a handle and that the key is obtained by dereferencing this handle.
T | is the element type. | |
Key | is the key type. | |
GetKey | is the functor that gets the key from the element. | |
CompareKeys | is a functor that takes two keys as arguments and returns a boolean. It is used to order the objects in the priority queue. For less than comparisons, the top of the priority queue holds the element with minimum key. This is the default behavior. | |
Sequence | is the container for the binary heap. It is std::vector<T> by default. |
PriorityQueueBinaryHeapArray< T, Key, GetKey, CompareKeys, Sequence >::PriorityQueueBinaryHeapArray | ( | const DataArray & | data_array, | |
const sequence_type & | container = sequence_type() | |||
) | [inline] |
Make from a container of values.
The default constructor makes an empty queue.
References PriorityQueueBinaryHeapDynamicKeys< T, GetHandle, Key, GetKey, CompareKeys, Sequence >::_get_handle, PriorityQueueBinaryHeapArray< T, Key, GetKey, CompareKeys, Sequence >::_heap_handles, and HeapHandleArray< DataConstIterator, HeapIterator >::initialize().