- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# tbb::interface5::concurrent_priority_queue< T, Compare, A > Class Template Reference

Concurrent priority queue. More...

`#include <concurrent_priority_queue.h>`

List of all members.

## Public Types
typedef T | value_type
| Element type in the queue.
typedef T & | reference
| Reference type.
typedef const T & | const_reference
| Const reference type.
typedef size_t | size_type
| Integral type for representing size of the queue.
typedef ptrdiff_t | difference_type
| Difference type for iterator.
typedef A | allocator_type
| Allocator type.
## Public Member Functions
| concurrent_priority_queue (const allocator_type &a=allocator_type())
| Constructs a new concurrent_priority_queue with default capacity.
| concurrent_priority_queue (size_type init_capacity, const allocator_type &a=allocator_type())
| Constructs a new concurrent_priority_queue with init_sz capacity.
template<typename InputIterator>
| concurrent_priority_queue (InputIterator begin, InputIterator end, const allocator_type &a=allocator_type())
| [begin,end) constructor
| concurrent_priority_queue (const concurrent_priority_queue &src, const allocator_type &a=allocator_type())
| Copy constructor.
concurrent_priority_queue & | operator= (const concurrent_priority_queue &src)
| Assignment operator.
| ~concurrent_priority_queue ()
| Destroys a concurrent_priority_queue.
bool | empty () const
| Returns true if empty, false otherwise.
size_type | size () const
| Returns the current number of elements contained in the queue.
size_type | capacity () const
| Returns the current capacity (i.e. allocated storage) of the queue.
void | push (const_reference elem)
| Pushes elem onto the queue, increasing capacity of queue if necessary.
bool | try_pop (reference elem)
| Gets a reference to and removes highest priority element.
void | reserve (size_type new_cap)
| If current capacity is less than new_cap, increases capacity to new_cap.
void | clear ()
| Clear the queue; not thread-safe.
void | shrink_to_fit ()
| Shrink queue capacity to current contents; not thread-safe.
void | swap (concurrent_priority_queue &q)
| Swap this queue with another; not thread-safe.
allocator_type | get_allocator () const
| Return allocator object.
## Classes
class | cpq_operation
struct | helper_type
| A helper object to save space.

## Detailed Description

### template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>
class tbb::interface5::concurrent_priority_queue< T, Compare, A >

Concurrent priority queue.

## Constructor & Destructor Documentation

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

tbb::interface5::concurrent_priority_queue< T, Compare, A >::concurrent_priority_queue | ( | const concurrent_priority_queue< T, Compare, A > & | src,
|  | const allocator_type & | a = `allocator_type()` |
| ) |  |  | `[inline]`

Copy constructor.

State of this queue may not reflect results of pending operations on the copied queue.

## Member Function Documentation

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

size_type tbb::interface5::concurrent_priority_queue< T, Compare, A >::capacity | ( |  | ) | const`[inline]`

Returns the current capacity (i.e. allocated storage) of the queue.

Returned value may not reflect results of pending operations.

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

void tbb::interface5::concurrent_priority_queue< T, Compare, A >::clear | ( |  | ) | `[inline]`

Clear the queue; not thread-safe.

Resets size, effectively emptying queue; does not free space. May not clear elements added in pending operations.

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

bool tbb::interface5::concurrent_priority_queue< T, Compare, A >::empty | ( |  | ) | const`[inline]`

Returns true if empty, false otherwise.

Returned value may not reflect results of pending operations.

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

concurrent_priority_queue& tbb::interface5::concurrent_priority_queue< T, Compare, A >::operator= | ( | const concurrent_priority_queue< T, Compare, A > & | src | ) | `[inline]`

Assignment operator.

State of this queue may not reflect results of pending operations on the copied queue.

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

size_type tbb::interface5::concurrent_priority_queue< T, Compare, A >::size | ( |  | ) | const`[inline]`

Returns the current number of elements contained in the queue.

Returned value may not reflect results of pending operations.

template<typename T, typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>

bool tbb::interface5::concurrent_priority_queue< T, Compare, A >::try_pop | ( | reference | elem | ) | `[inline]`

Gets a reference to and removes highest priority element.

If a highest priority element was found, sets elem and returns true, otherwise returns false.

The documentation for this class was generated from the following file:

- concurrent_priority_queue.h

Copyright © 2005-2010 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.