|
BDE 4.39.x Production Release
|
#include <bslstl_priorityqueue.h>
This class is a value-semantic class template, adapting a container of the (template parameter) type CONTAINER, that holds elements of the (template parameter) type VALUE, to provide a highest-priority-first priority queue data structure, where the priorities of elements are compared by a comparator of the template parameter type, COMPARATOR. The container object held by a priority_queue class object is referenced as c in the following documentation.
Public Types | |
| typedef CONTAINER | container_type |
| typedef COMPARATOR | value_compare |
| typedef CONTAINER::value_type | value_type |
| typedef CONTAINER::reference | reference |
| typedef CONTAINER::const_reference | const_reference |
| typedef CONTAINER::size_type | size_type |
Public Member Functions | |
| BSLMF_NESTED_TRAIT_DECLARATION_IF (priority_queue, BloombergLP::bslma::UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator< container_type >::value) | |
| priority_queue () | |
| priority_queue (const COMPARATOR &comparator) | |
| priority_queue (const COMPARATOR &comparator, const CONTAINER &container) | |
| priority_queue (const COMPARATOR &comparator, BloombergLP::bslmf::MovableRef< CONTAINER > container) | |
| template<class INPUT_ITERATOR > | |
| priority_queue (INPUT_ITERATOR first, INPUT_ITERATOR last) | |
| template<class INPUT_ITERATOR > | |
| priority_queue (INPUT_ITERATOR first, INPUT_ITERATOR last, const COMPARATOR &comparator, const CONTAINER &container) | |
| template<class INPUT_ITERATOR > | |
| priority_queue (INPUT_ITERATOR first, INPUT_ITERATOR last, const COMPARATOR &comparator, BloombergLP::bslmf::MovableRef< CONTAINER > container) | |
| priority_queue (const priority_queue &original) | |
| priority_queue (BloombergLP::bslmf::MovableRef< priority_queue > original) | |
| template<class ALLOCATOR > | |
| priority_queue (const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
| template<class ALLOCATOR > | |
| priority_queue (const COMPARATOR &comparator, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
| template<class ALLOCATOR > | |
| priority_queue (const COMPARATOR &comparator, const CONTAINER &container, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
| template<class ALLOCATOR > | |
| priority_queue (const COMPARATOR &comparator, BloombergLP::bslmf::MovableRef< CONTAINER > container, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
| template<class ALLOCATOR > | |
| priority_queue (const priority_queue &original, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
| template<class ALLOCATOR > | |
| priority_queue (BloombergLP::bslmf::MovableRef< priority_queue > original, const ALLOCATOR &basicAllocator, typename enable_if< bsl::uses_allocator< CONTAINER, ALLOCATOR >::value, ALLOCATOR >::type *=0) | |
| template<class t_RANGE > | |
| priority_queue (from_range_t, BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range, const COMPARATOR &comparator=COMPARATOR()) | |
| template<class t_RANGE , class t_ALLOCATOR > | |
| priority_queue (from_range_t, BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range, const COMPARATOR &comparator, const t_ALLOCATOR &allocator, typename enable_if< bsl::uses_allocator< CONTAINER, t_ALLOCATOR >::value, t_ALLOCATOR >::type *=0) | |
| template<class t_RANGE , class t_ALLOCATOR > | |
| priority_queue (from_range_t, BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range, const t_ALLOCATOR &allocator, typename enable_if< bsl::uses_allocator< CONTAINER, t_ALLOCATOR >::value, t_ALLOCATOR >::type *=0) | |
| priority_queue & | operator= (const priority_queue &rhs) |
| priority_queue & | operator= (BloombergLP::bslmf::MovableRef< priority_queue > rhs) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(false) |
| void | push (const value_type &value) |
| void | push (BloombergLP::bslmf::MovableRef< value_type > value) |
| template<class t_RANGE > | |
| void | push_range (BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) range) |
| template<class... Args> | |
| void | emplace (Args &&... args) |
| void | pop () |
| size_type | size () const |
| const_reference | top () const |
Public Attributes | |
| void swap(priority_queue &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl bool | empty () const |
Protected Attributes | |
| CONTAINER | c |
| COMPARATOR | comp |
| typedef CONTAINER::const_reference bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::const_reference |
| typedef CONTAINER bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::container_type |
| typedef CONTAINER::reference bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::reference |
| typedef CONTAINER::size_type bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::size_type |
| typedef COMPARATOR bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::value_compare |
| typedef CONTAINER::value_type bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::value_type |
|
inline |
Create an empty priority queue, adapting a default-constructed container of the (template parameter) type CONTAINER. Use a default-constructed comparator of the (template parameter) type COMPARATOR to order elements in the priority queue.
|
inlineexplicit |
Create an empty priority queue, adapting a default-constructed container of the (template parameter) type CONTAINER, and having the specified comparator of the (template parameter) type COMPARATOR to order elements in the priority queue.
|
inline |
Create a priority queue, adapting the specified container of the (template parameter) type CONTAINER, and having the specified comparator of the (template parameter) type COMPARATOR to order elements in the priority queue.
|
inlineexplicit |
Create a priority queue, adapting the specified container of the (template parameter) type CONTAINER, and having the specified comparator of the (template parameter) type COMPARATOR to order elements in the priority queue.
|
inline |
Create a priority queue, adapting a default-constructed container of the (template parameter) type CONTAINER, and inserting into the container a sequence of value_type elements that starts at the specified first and ends immediately before the specified last. Use a default-constructed comparator of the (template parameter) type COMPARATOR to order elements in the priority queue.
|
inline |
Create a priority queue, adapting the specified container, having the specified comparator to order the priorities of elements, including those originally existed in container, and those inserted into the container from a sequence of value_type elements starting at the specified first, and ending immediately before the specified last.
|
inline |
Create a priority queue, adapting the specified container, having the specified comparator to order elements in the priority queue, including those originally existed in container, and those inserted into the container from a sequence of value_type elements starting at the specified first, and ending immediately before the specified last.
|
inline |
Create a priority queue having the same value as the specified original object. Use a copy of the comparator from original to order elements in the priority queue.
|
inline |
Create a priority queue having the same value as the specified original object. Use a copy of the comparator from original to order elements in the priority queue.
|
inlineexplicit |
Create an empty priority queue, adapting a default-constructed container of the (template parameter) type CONTAINER that uses the specified basicAllocator to supply memory. Use a default-constructed object of the (template parameter) type COMPARATOR to order elements in the priority queue.
|
inline |
Create an empty priority queue, adapting a default-constructed container of the (template parameter) type CONTAINER that uses the specified basicAllocator to supply memory, and the specified comparator to order elements in the priority queue.
|
inline |
Create a priority queue, adapting the specified container that uses the specified basicAllocator to supply memory, and the specified comparator to order elements in the priority queue.
|
inline |
Create a priority queue, adapting the specified container that uses the specified basicAllocator to supply memory, and the specified comparator to order elements in the priority queue.
|
inline |
Create a priority queue having the same value as the specified original object and using the specified basicAllocator to supply memory. Use a copy of the comparator from original to order elements in the priority queue.
|
inline |
Create a priority queue having the same value as the specified original object and using the specified basicAllocator to supply memory. Use a copy of the comparator from original to order elements in the priority queue.
|
inline |
Create a priority queue from the elements of the specified range. Optionally specify a comparator used to order elements in the priority queue. Optionally supply an allocator to supply memory. If allocator is not supplied and if CONTAINER is allocator aware, the currently installed default allocator is used.
range must (minimally) meet the requirements of an input range and the values from the range must have a type matching or convertible to (template parameter) VALUE. Also note that the constructor overloads that take allocators are defined only if the underlying CONTAINTER is allocator aware.
|
inline |
|
inline |
| bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::BSLMF_NESTED_TRAIT_DECLARATION_IF | ( | priority_queue< VALUE, CONTAINER, COMPARATOR > | , |
| BloombergLP::bslma::UsesBslmaAllocator | , | ||
| BloombergLP::bslma::UsesBslmaAllocator< container_type >::value | |||
| ) |
|
inline |
Insert into this priority queue a newly created value_type object, constructed by forwarding the specified (variable number of) args to the corresponding constructor of value_type. In effect, performs c.emplace_back(FORWARD(Args,args)...);.
|
inline |
Assign to this object the value and comparator of the specified rhs object and return a reference providing modifiable access to this object. rhs is left in a valid but unspecified state.
|
inline |
Assign to this object the value and comparator of the specified rhs object and return a reference providing modifiable access to this object.
|
inline |
Remove the top element from this priority_queue object that has the highest priority. In effect, performs c.pop_back();.
|
inline |
Insert the specified value into this priority queue. In effect, performs c.push_back(value);.
|
inline |
Insert the specified value into this priority queue. In effect, performs c.push_back(value);.
| void bsl::priority_queue< VALUE, CONTAINER, COMPARATOR >::push_range | ( | BSLS_COMPILERFEATURES_FORWARD_REF(t_RANGE) | range | ) |
Insert the elements of the specified range into this priority queue.
range must meet the requirements of an input range and the values from range must have a type matching or convertible to (template parameter) VALUE.
|
inline |
Return the number of elements in this priority_queue object. In effect, performs return c.size().
|
inline |
Return a reference providing non-modifiable access to the element having the highest priority in this priority_queue object. In effect, performs return c.front().
|
protected |
|
protected |
|
inline |
Efficiently exchange the value of this object with the value of the specified other object. In effect, performs using bsl::swap; swap(c, other.c);. Return true if this priority_queue object contains no elements, and false otherwise. In effect, performs return c.empty();.