Classes | Public Types | Public Member Functions | List of all members
tbb::interface5::concurrent_priority_queue< T, Compare, A > Class Template Reference

Concurrent priority queue. More...

#include <concurrent_priority_queue.h>

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 (std::initializer_list< T > const &init_list, const allocator_type &a=allocator_type())
 Constructor from std::initializer_list.
 
 concurrent_priority_queue (const concurrent_priority_queue &src)
 Copy constructor. More...
 
 concurrent_priority_queue (const concurrent_priority_queue &src, const allocator_type &a)
 Copy constructor with specific allocator. More...
 
concurrent_priority_queueoperator= (const concurrent_priority_queue &src)
 Assignment operator. More...
 
template<typename InputIterator >
void assign (InputIterator begin, InputIterator end)
 Assign the queue from [begin,end) range, not thread-safe.
 
void assign (std::initializer_list< T > const &il)
 Assign the queue from std::initializer_list, not thread-safe.
 
concurrent_priority_queueoperator= (std::initializer_list< T > const &il)
 Assign from std::initializer_list, not thread-safe.
 
bool empty () const
 Returns true if empty, false otherwise. More...
 
size_type size () const
 Returns the current number of elements contained in the queue. More...
 
void push (const_reference elem)
 Pushes elem onto the queue, increasing capacity of queue if necessary. More...
 
bool try_pop (reference elem)
 Gets a reference to and removes highest priority element. More...
 
void clear ()
 Clear the queue; not thread-safe. More...
 
void swap (concurrent_priority_queue &q)
 Swap this queue with another; not thread-safe. More...
 
allocator_type get_allocator () const
 Return allocator object.
 

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)
inlineexplicit

Copy constructor.

This operation is unsafe if there are pending concurrent operations on the src queue.

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 
)
inline

Copy constructor with specific allocator.

This operation is unsafe if there are pending concurrent operations on the src queue.

Member Function Documentation

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.

This operation is unsafe if there are pending concurrent operations on the queue. 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. This operation reads shared data and will trigger a race condition.

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.

This operation is unsafe if there are pending concurrent operations on the src queue.

template<typename T , typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>
void tbb::interface5::concurrent_priority_queue< T, Compare, A >::push ( const_reference  elem)
inline

Pushes elem onto the queue, increasing capacity of queue if necessary.

This operation can be safely used concurrently with other push, try_pop or reserve operations.

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. This operation reads shared data and will trigger a race condition.

template<typename T , typename Compare = std::less<T>, typename A = cache_aligned_allocator<T>>
void tbb::interface5::concurrent_priority_queue< T, Compare, A >::swap ( concurrent_priority_queue< T, Compare, A > &  q)
inline

Swap this queue with another; not thread-safe.

This operation is unsafe if there are pending concurrent operations on the queue.

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. This operation can be safely used concurrently with other push, try_pop or reserve operations.


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

Copyright © 2005-2014 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.