NVBIO
|
Efficient double-ended priority queue.
Type | Type of elements in the priority deque. |
Sequence | Underlying sequence container. Must provide random-access iterators, front(), push_back(Type const &), and pop_back(). Defaults to std::vector<Type>. |
Compare | Comparison class. Compare(A, B) should return true if A should be placed earlier than B in a strict weak ordering. Defaults to std::less<Type>, which encapsulates operator<. |
Priority deques are adaptors, designed to provide efficient insertion and access to both ends of a weakly-ordered list of elements. As a container adaptor, priority_deque is implemented on top of another container type. By default, this is std::vector, but a different container may be specified explicitly. Although the priority deque does permit iteration through its elements, there is no ordering guaranteed, as different implementations may benefit from different structures, and all iterators should be discarded after using any function not labeled const.
Definition at line 49 of file priority_deque.hpp.
#include <priority_deque.hpp>
Public Types | |
typedef Sequence | container_type |
typedef container_type::value_type | value_type |
typedef Compare | value_compare |
typedef container_type::size_type | size_type |
typedef container_type::const_reference | const_reference |
typedef container_type::reference | reference |
typedef container_type::pointer | pointer |
typedef pointer | const_pointer |
typedef container_type::const_iterator | const_iterator |
typedef const_iterator | iterator |
typedef container_type::difference_type | difference_type |
Public Methods | |
priority_deque (const Compare &=Compare(), const Sequence &=Sequence()) | |
Constructs a new priority deque. More... | |
template<typename InputIterator > | |
priority_deque (InputIterator first, InputIterator last, const Compare &=Compare(), const Sequence &=Sequence()) | |
Constructs a new priority deque from a sequence of elements. More... | |
void | push (const value_type &) |
Copies an element into the priority deque. More... | |
void | clear (void) |
Removes all elements from the priority deque. More... | |
void | swap (priority_deque< Type, Sequence, Compare > &) |
Moves the elements from this deque into another, and vice-versa. More... | |
template<typename InputIterator > | |
priority_deque (InputIterator first, InputIterator last, const C &comp, const S &seq) | |
template<typename InputIterator > | |
void | merge (InputIterator first, InputIterator last) |
const_reference | maximum (void) const |
Accesses a maximal element in the deque. More... | |
const_reference | minimum (void) const |
Accesses a minimal element in the deque. More... | |
const_reference | top (void) const |
void | pop_maximum (void) |
Removes a maximal element from the deque. More... | |
void | pop_minimum (void) |
Removes a minimal element from the deque. More... | |
void | pop (void) |
bool | empty (void) const |
Returns true if the priority deque is empty, false if it is not. More... | |
size_type | size (void) const |
Returns the number of elements in the priority deque. More... | |
size_type | max_size (void) const |
Returns the maximum number of elements that can be contained. More... | |
template<typename InputIterator > | |
void | merge (InputIterator first, InputIterator last) |
Merges a sequence of elements into the priority deque. More... | |
template<typename SourceContainer > | |
void | merge (const SourceContainer &source) |
Merges a container's elements into the priority deque. More... | |
const_iterator | begin (void) const |
Returns a const iterator at the beginning of the sequence. More... | |
const_iterator | end (void) const |
Returns a const iterator past the end of the sequence. More... | |
void | update (const_iterator, const value_type &) |
Modifies a specified element of the deque. More... | |
void | erase (const_iterator) |
Removes a specified element from the deque. More... | |
Static Public Members | |
static const bool | constant_time_size = true |
static const bool | has_ordered_iterators = false |
static const bool | is_mergable = true |
static const bool | is_stable = false |
static const bool | has_reserve = false |
Proteced Methods | |
container_type & | sequence (void) |
const container_type & | sequence (void) const |
value_compare & | compare (void) |
const value_compare & | compare (void) const |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T , typename S , typename C > | |
void | swap (priority_deque< T, S, C > &deque1, priority_deque< T, S, C > &deque2) |
typedef container_type::const_iterator boost::container::priority_deque< Type, Sequence, Compare >::const_iterator |
May be used to examine, but not modify, elements in the deque.
Definition at line 107 of file priority_deque.hpp.
typedef pointer boost::container::priority_deque< Type, Sequence, Compare >::const_pointer |
Definition at line 105 of file priority_deque.hpp.
typedef container_type::const_reference boost::container::priority_deque< Type, Sequence, Compare >::const_reference |
May be used to examine, but not modify, an element in the deque.
Definition at line 102 of file priority_deque.hpp.
typedef Sequence boost::container::priority_deque< Type, Sequence, Compare >::container_type |
Underlying container type.
Definition at line 96 of file priority_deque.hpp.
typedef container_type::difference_type boost::container::priority_deque< Type, Sequence, Compare >::difference_type |
STL Container specifies that this is a signed integral type.
Definition at line 110 of file priority_deque.hpp.
typedef const_iterator boost::container::priority_deque< Type, Sequence, Compare >::iterator |
Definition at line 108 of file priority_deque.hpp.
typedef container_type::pointer boost::container::priority_deque< Type, Sequence, Compare >::pointer |
Definition at line 104 of file priority_deque.hpp.
typedef container_type::reference boost::container::priority_deque< Type, Sequence, Compare >::reference |
Definition at line 103 of file priority_deque.hpp.
typedef container_type::size_type boost::container::priority_deque< Type, Sequence, Compare >::size_type |
STL Container specifies that this is an unsigned integral type.
Definition at line 100 of file priority_deque.hpp.
typedef Compare boost::container::priority_deque< Type, Sequence, Compare >::value_compare |
Definition at line 98 of file priority_deque.hpp.
typedef container_type::value_type boost::container::priority_deque< Type, Sequence, Compare >::value_type |
Definition at line 97 of file priority_deque.hpp.
|
explicit |
Constructs a new priority deque.
comp | Comparison class. |
seq | Container class. |
Definition at line 243 of file priority_deque.hpp.
boost::container::priority_deque< T, S, C >::priority_deque | ( | InputIterator | first, |
InputIterator | last, | ||
const C & | comp = Compare() , |
||
const S & | seq = Sequence() |
||
) |
Constructs a new priority deque from a sequence of elements.
first,last | Range of elements. |
comp | Instance of comparison class. |
seq | Instance of container class. |
Definition at line 268 of file priority_deque.hpp.
|
inline |
Returns a const iterator at the beginning of the sequence.
Definition at line 197 of file priority_deque.hpp.
|
inline |
Removes all elements from the priority deque.
Definition at line 180 of file priority_deque.hpp.
|
inlineprotected |
Definition at line 226 of file priority_deque.hpp.
|
inlineprotected |
Definition at line 227 of file priority_deque.hpp.
|
inline |
Returns true if the priority deque is empty, false if it is not.
Definition at line 169 of file priority_deque.hpp.
|
inline |
Returns a const iterator past the end of the sequence.
Definition at line 199 of file priority_deque.hpp.
void boost::container::priority_deque< T, Sequence, Compare >::erase | ( | const_iterator | random_it) |
Removes a specified element from the deque.
random_it | An iterator in the range [begin, end) |
Definition at line 508 of file priority_deque.hpp.
|
inline |
Returns the maximum number of elements that can be contained.
Definition at line 173 of file priority_deque.hpp.
|
inline |
Accesses a maximal element in the deque.
Definition at line 349 of file priority_deque.hpp.
void boost::container::priority_deque< T, S, C >::merge | ( | InputIterator | first, |
InputIterator | last | ||
) |
Merges a sequence of elements into the priority deque.
first,last | Input iterators bounding the range [ first, last) |
Definition at line 424 of file priority_deque.hpp.
|
inline |
Merges a container's elements into the priority deque.
Definition at line 189 of file priority_deque.hpp.
priority_deque< T, Sequence, Compare >::const_reference boost::container::priority_deque< T, Sequence, Compare >::minimum | ( | void | ) | const |
Accesses a minimal element in the deque.
Definition at line 364 of file priority_deque.hpp.
|
inline |
Identical to std::priority_queue pop().
Definition at line 163 of file priority_deque.hpp.
void boost::container::priority_deque< T, Sequence, Compare >::pop_maximum | ( | void | ) |
Removes a maximal element from the deque.
Definition at line 399 of file priority_deque.hpp.
void boost::container::priority_deque< T, Sequence, Compare >::pop_minimum | ( | void | ) |
Removes a minimal element from the deque.
Definition at line 379 of file priority_deque.hpp.
void boost::container::priority_deque< T, Sequence, Compare >::push | ( | const value_type & | value) |
Copies an element into the priority deque.
value | Element to add the the priority deque. |
Definition at line 306 of file priority_deque.hpp.
|
inlineprotected |
Definition at line 224 of file priority_deque.hpp.
|
inlineprotected |
Definition at line 225 of file priority_deque.hpp.
|
inline |
Returns the number of elements in the priority deque.
Definition at line 171 of file priority_deque.hpp.
|
inline |
Moves the elements from this deque into another, and vice-versa.
other | Priority deque with which to swap. |
Definition at line 443 of file priority_deque.hpp.
|
inline |
Identical to std::priority_queue top().
Definition at line 155 of file priority_deque.hpp.
void boost::container::priority_deque< T, S, C >::update | ( | const_iterator | random_it, |
const value_type & | value | ||
) |
Modifies a specified element of the deque.
random_it | A valid iterator in the range [begin, end). |
value | The new value. |
Elements within the deque may be unordered.
Definition at line 476 of file priority_deque.hpp.
|
related |
deque1,deque2 | Priority deques. |
Definition at line 456 of file priority_deque.hpp.
|
static |
Definition at line 212 of file priority_deque.hpp.
|
static |
Definition at line 214 of file priority_deque.hpp.
|
static |
Definition at line 220 of file priority_deque.hpp.
|
static |
Definition at line 216 of file priority_deque.hpp.
|
static |
Definition at line 218 of file priority_deque.hpp.