Similar to std::priority_queue, with the following differences:
#include <pq_helpers.h>
Public Types | |
typedef _Sequence::value_type | value_type |
typedef _Sequence::reference | reference |
typedef _Sequence::const_reference | const_reference |
typedef _Sequence::size_type | size_type |
typedef _Sequence | container_type |
Public Member Functions | |
internal_priority_queue (size_type capacity) | |
Default constructor creates no elements. | |
bool | empty () const |
size_type | size () const |
const_reference | top () const |
void | push (const value_type &__x) |
Add data to the queue. | |
void | pop () |
Removes first element. | |
void | sort_to (value_type *target) |
Sort all contained elements, write result to target . | |
void | clear () |
Remove all contained elements. | |
Protected Attributes | |
_Sequence | heap |
_Compare | comp |
size_type | current_size |
Similar to std::priority_queue, with the following differences:
priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::internal_priority_queue | ( | size_type | capacity | ) | [inline, explicit] |
Default constructor creates no elements.
void priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::clear | ( | ) | [inline] |
Remove all contained elements.
bool priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::empty | ( | ) | const [inline] |
Returns true if the queue is empty.
Referenced by priority_queue< Config_ >::pop(), priority_queue< Config_ >::push(), and priority_queue< Config_ >::top().
void priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::pop | ( | ) | [inline] |
Removes first element.
This is a typical queue operation. It shrinks the queue by one. The time complexity of the operation depends on the underlying sequence.
Note that no data is returned, and if the first element's data is needed, it should be retrieved before pop() is called.
Referenced by priority_queue< Config_ >::pop().
void priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::push | ( | const value_type & | __x | ) | [inline] |
Add data to the queue.
__x | Data to be added. |
This is a typical queue operation. The time complexity of the operation depends on the underlying sequence.
Referenced by priority_queue< Config_ >::push().
size_type priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::size | ( | ) | const [inline] |
Returns the number of elements in the queue.
Referenced by priority_queue< Config_ >::push(), and priority_queue< Config_ >::size().
void priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::sort_to | ( | value_type * | target | ) | [inline] |
Sort all contained elements, write result to target
.
const_reference priority_queue_local::internal_priority_queue< _Tp, _Sequence, _Compare >::top | ( | ) | const [inline] |
Returns a read-only (constant) reference to the data at the first element of the queue.
Referenced by priority_queue< Config_ >::pop(), and priority_queue< Config_ >::top().