Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

concurrent_priority_queue Class

The concurrent_priority_queue class is a container that allows multiple threads to concurrently push and pop items. Items are popped in priority order where priority is determined by a functor supplied as a template argument.

template <
   typename _Ty,
   typename _Compare=std::less<_Ty>,
   typename _Ax = std::allocator<_Ty>
>
, typename _Ax = std::allocator<_Ty> > class concurrent_priority_queue;

_Ty

The data type of the elements to be stored in the priority queue.

_Compare

The type of the function object that can compare two element values as sort keys to determine their relative order in the priority queue. This argument is optional and the binary predicate less<_Ty> is the default value.

_Ax

The type that represents the stored allocator object that encapsulates details about the allocation and deallocation of memory for the concurrent priority queue. This argument is optional and the default value is allocator<_Ty>.

Name

Description

allocator_type

A type that represents the allocator class for the concurrent priority queue.

const_reference

A type that represents a const reference to an element of the type stored in a concurrent priority queue.

reference

A type that represents a reference to an element of the type stored in a concurrent priority queue.

size_type

A type that counts the number of elements in a concurrent priority queue.

value_type

A type that represents the data type stored in a concurrent priority queue.

Name

Description

concurrent_priority_queue::concurrent_priority_queue Constructor

Overloaded. Constructs a concurrent priority queue.

Name

Description

concurrent_priority_queue::clear Method

Erases all elements in the concurrent priority. This method is not concurrency-safe.

concurrent_priority_queue::empty Method

Tests if the concurrent priority queue is empty at the time this method is called. This method is concurrency-safe.

concurrent_priority_queue::get_allocator Method

Returns a copy of the allocator used to construct the concurrent priority queue. This method is concurrency-safe.

concurrent_priority_queue::push Method

Overloaded. Adds an element to the concurrent priority queue. This method is concurrency-safe.

concurrent_priority_queue::size Method

Returns the number of elements in the concurrent priority queue. This method is concurrency-safe.

concurrent_priority_queue::swap Method

Swaps the contents of two concurrent priority queues. This method is not concurrency-safe.

concurrent_priority_queue::try_pop Method

Removes and returns the highest priority element from the queue if the queue is non-empty. This method is concurrency-safe.

Name

Description

concurrent_priority_queue::operator= Operator

Overloaded. Assigns the contents of another concurrent_priority_queue object to this one. This method is not concurrency-safe.

For detailed information on the concurrent_priority_queue class, see Parallel Containers and Objects.

concurrent_priority_queue

Header: concurrent_priority_queue.h

Namespace: concurrency

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft