Nugget
Public Types | Public Member Functions | Public Attributes | List of all members
eastl::priority_queue< T, Container, Compare > Class Template Reference

#include <priority_queue.h>

Collaboration diagram for eastl::priority_queue< T, Container, Compare >:
Collaboration graph
[legend]

Public Types

typedef priority_queue< T, Container, Compare > this_type
 
typedef Container container_type
 
typedef Compare compare_type
 
typedef Container::value_type value_type
 
typedef Container::reference reference
 
typedef Container::const_reference const_reference
 
typedef Container::size_type size_type
 
typedef Container::difference_type difference_type
 

Public Member Functions

template<class Allocator >
 priority_queue (const Allocator &allocator, typename eastl::enable_if< eastl::uses_allocator< container_type, Allocator >::value >::type *=NULL)
 
template<class Allocator >
 priority_queue (const this_type &x, const Allocator &allocator, typename eastl::enable_if< eastl::uses_allocator< container_type, Allocator >::value >::type *=NULL)
 
template<class Allocator >
 priority_queue (this_type &&x, const Allocator &allocator, typename eastl::enable_if< eastl::uses_allocator< container_type, Allocator >::value >::type *=NULL)
 
 priority_queue (const compare_type &compare)
 
 priority_queue (const compare_type &compare, container_type &&x)
 
 priority_queue (const compare_type &compare, const container_type &x)
 
 priority_queue (std::initializer_list< value_type > ilist, const compare_type &compare=compare_type())
 
template<typename InputIterator >
 priority_queue (InputIterator first, InputIterator last)
 
template<typename InputIterator >
 priority_queue (InputIterator first, InputIterator last, const compare_type &compare)
 
template<typename InputIterator >
 priority_queue (InputIterator first, InputIterator last, const compare_type &compare, const container_type &x)
 
template<class InputIterator >
 priority_queue (InputIterator first, InputIterator last, const compare_type &compare, container_type &&x)
 
bool empty () const
 
size_type size () const
 
const_reference top () const
 
void push (const value_type &value)
 
void push (value_type &&x)
 
template<class... Args>
void emplace (Args &&... args)
 
void pop ()
 
void pop (value_type &value)
 
void change (size_type n)
 
void remove (size_type n)
 Moves the item at the given array index to a new location based on its current priority.
 
container_type & get_container ()
 Removes the item at the given array index.
 
const container_type & get_container () const
 

Public Attributes

container_type c
 
compare_type comp
 
void swap(this_type &x) EA_NOEXCEPT_IF((eastl bool validate () const
 

Detailed Description

template<typename T, typename Container = eastl::vector<T>, typename Compare = eastl::less<typename Container::value_type>>
class eastl::priority_queue< T, Container, Compare >

priority_queue

The behaviour of this class is just like the std::priority_queue class and you can refer to std documentation on it.

A priority_queue is an adapter container which implements a queue-like container whereby pop() returns the item of highest priority. The entire queue isn't necessarily sorted; merely the first item in the queue happens to be of higher priority than other items. You can read about priority_queues in many books on algorithms, such as "Algorithms" by Robert Sedgewick.

The Container type is a container which is random access and supports empty(), size(), clear(), insert(), front(), push_back(), and pop_back(). You would typically use vector or deque.

Note that we don't provide functions in the priority_queue interface for working with allocators or names. The reason for this is that priority_queue is an adapter class which can work with any standard sequence and not necessarily just a sequence provided by this library. So what we do is provide a member accessor function get_container() which allows the user to manipulate the sequence as needed. The user needs to be careful not to change the container's contents, however.

Classic heaps allow for the concept of removing arbitrary items and changing the priority of arbitrary items, though the C++ std heap (and thus priority_queue) functions don't support these operations. We have extended the heap algorithms and the priority_queue implementation to support these operations.


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