libstdc++
|
Public Member Functions | |
priority_queue (const _Compare &__x, const _Sequence &__s) | |
priority_queue (const _Compare &__x=_Compare(), _Sequence &&__s=_Sequence()) | |
template<typename _Alloc , typename _Requires = _Uses<_Alloc>> | |
priority_queue (const _Alloc &__a) | |
template<typename _Alloc , typename _Requires = _Uses<_Alloc>> | |
priority_queue (const _Compare &__x, const _Alloc &__a) | |
template<typename _Alloc , typename _Requires = _Uses<_Alloc>> | |
priority_queue (const _Compare &__x, const _Sequence &__c, const _Alloc &__a) | |
template<typename _Alloc , typename _Requires = _Uses<_Alloc>> | |
priority_queue (const _Compare &__x, _Sequence &&__c, const _Alloc &__a) | |
template<typename _Alloc , typename _Requires = _Uses<_Alloc>> | |
priority_queue (const priority_queue &__q, const _Alloc &__a) | |
template<typename _Alloc , typename _Requires = _Uses<_Alloc>> | |
priority_queue (priority_queue &&__q, const _Alloc &__a) | |
template<typename _InputIterator > | |
priority_queue (_InputIterator __first, _InputIterator __last, const _Compare &__x, const _Sequence &__s) | |
template<typename _InputIterator > | |
priority_queue (_InputIterator __first, _InputIterator __last, const _Compare &__x=_Compare(), _Sequence &&__s=_Sequence()) | |
template<typename... _Args> | |
void | emplace (_Args &&...__args) |
bool | empty () const |
void | pop () |
void | push (const value_type &__x) |
void | push (value_type &&__x) |
size_type | size () const |
void | swap (priority_queue &__pq) noexcept(__is_nothrow_swappable< _Tp >::value &&__is_nothrow_swappable< _Compare >::value) |
const_reference | top () const |
Protected Attributes | |
_Sequence | c |
_Compare | comp |
A standard container automatically sorting its contents.
_Tp | Type of element. |
_Sequence | Type of underlying sequence, defaults to vector<_Tp>. |
_Compare | Comparison function object type, defaults to less<_Sequence::value_type>. |
This is not a true container, but an adaptor. It holds another container, and provides a wrapper interface to that container. The wrapper is what enforces priority-based sorting and queue behavior. Very few of the standard container/sequence interface requirements are met (e.g., iterators).
The second template parameter defines the type of the underlying sequence/container. It defaults to std::vector, but it can be any type that supports front()
, push_back
, pop_back
, and random-access iterators, such as std::deque or an appropriate user-defined type.
The third template parameter supplies the means of making priority comparisons. It defaults to less<value_type>
but can be anything defining a strict weak ordering.
Members not found in normal containers are container_type
, which is a typedef for the second Sequence parameter, and push
, pop
, and top
, which are standard queue operations.
Definition at line 397 of file stl_queue.h.
|
inlineexplicit |
Default constructor creates no elements.
Definition at line 438 of file stl_queue.h.
References std::queue< _Tp, _Sequence >::c, and std::make_heap().
|
inline |
Builds a queue from a range.
__first | An input iterator. |
__last | An input iterator. |
__x | A comparison functor describing a strict weak ordering. |
__s | An initial sequence with which to start. |
Begins by copying __s, inserting a copy of the elements from [first,last) into the copy of __s, then ordering the copy according to __x.
For more information on function objects, see the documentation on functor base classes.
Definition at line 504 of file stl_queue.h.
References std::queue< _Tp, _Sequence >::c, and std::make_heap().
|
inline |
Returns true if the queue is empty.
Definition at line 530 of file stl_queue.h.
Referenced by __gnu_parallel::multiseq_partition(), and __gnu_parallel::multiseq_selection().
|
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.
Definition at line 593 of file stl_queue.h.
References std::pop_heap().
Referenced by __gnu_parallel::multiseq_partition(), and __gnu_parallel::multiseq_selection().
|
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.
Definition at line 558 of file stl_queue.h.
References std::queue< _Tp, _Sequence >::push(), and std::push_heap().
Referenced by __gnu_parallel::multiseq_partition(), and __gnu_parallel::multiseq_selection().
|
inline |
Returns the number of elements in the queue.
Definition at line 535 of file stl_queue.h.
|
inline |
Returns a read-only (constant) reference to the data at the first element of the queue.
Definition at line 543 of file stl_queue.h.
Referenced by __gnu_parallel::multiseq_partition(), and __gnu_parallel::multiseq_selection().