Highest‐priority‐first priority queue adapter over a container of VALUE elements.

Synopsis

Declared in <bslstl_priorityqueue.h>

template<
    class VALUE,
    class CONTAINER = vector<VALUE>,
    class COMPARATOR = std::less<CONTAINER::value_type>>
class priority_queue;

Description

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.

Type Aliases

Name

Description

const_reference

This typedef is an alias to CONTAINER::const_reference.

container_type

This typedef is an alias for the adapted container type.

reference

This typedef is an alias to CONTAINER::reference.

size_type

This typedef is an alias to CONTAINER::size_type.

value_compare

This typedef is an alias for the element comparison type.

value_type

This typedef is an alias to CONTAINER::value_type.

Member Functions

Name

Description

priority_queue [constructor]

Constructors

operator=

Assignment operators

emplace

Emplace a newly constructed element into this priority queue.

empty

Return true if this priority_queue object contains no elements, and false otherwise. In effect, performs return c.empty();.

pop

Remove the highest‐priority element from this priority queue.

push

push overloads

push_range

Insert the elements of the specified range into this priority queue.

size

Return the number of elements in this priority_queue object. In effect, performs return c.size().

swap

Efficiently exchange the value of this object with other.

top

Return a reference to the highest‐priority element.

operator BloombergLP::bslmf::NestedTraitDeclaration<priority_queue, UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator<container_type>::value>

Nested trait declaration for UsesBslmaAllocator.

Protected Data Members

Name

Description

c

Underlying container holding the priority‐queue elements.

comp

Comparator that defines the priority order of elements.

Deduction Guides

Name

Description

priority_queue<VALUE>

Deduce the template parameter VALUE from the value_type of the iterators supplied to the constructor of priority_queue.

priority_queue<VALUE, CONTAINER, COMPARATOR>

Deduce the template parameter VALUE from the iterators supplied to the constructor of priority_queue.

priority_queue<t_TYPE, vector<t_TYPE>, t_COMPARATOR>

Deduce the template parameters VALUE and COMPARATOR from the parameters supplied to the constructor of priority_queue.

priority_queue<t_TYPE, vector<t_TYPE, t_ALLOCATOR>>

Deduce the template parameters VALUE and ALLOCATOR from the parameters supplied to the constructor of priority_queue.

priority_queue<t_TYPE, vector<t_TYPE, t_ALLOCATOR>, t_COMPARATOR>

Deduce the template parameters VALUE, COMPARATOR, and ALLOCATOR from the parameters supplied to the constructor of priority_queue.

priority_queue<CONTAINER::value_type, CONTAINER, COMPARATOR>

Deduce the template parameter VALUE and CONTAINER from the parameters supplied to the constructor of priority_queue.

priority_queue<CONTAINER::value_type, CONTAINER, COMPARATOR>

Deduce the template parameters VALUE, CONTAINER and COMPARATOR from the parameters supplied to the constructor of priority_queue.

Non-Member Functions

Name

Description

swap

Exchange the container and comparator of a with those of b.

Created with MrDocs