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 110 of file priority_deque.h.
#include <priority_deque.h>
Public Types | |
enum | Constructed { CONSTRUCTED } |
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 | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE | priority_deque (const Compare &=Compare(), const Sequence &=Sequence()) |
Constructs a new priority deque. More... | |
template<typename InputIterator > | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE | priority_deque (InputIterator first, InputIterator last, const Compare &=Compare(), const Sequence &=Sequence()) |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE | priority_deque (const Sequence &seq, const bool constructed=false) |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE | priority_deque (const Sequence &seq, const Constructed flag) |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | push (const value_type &) |
Copies an element into the priority deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | clear (void) |
Removes all elements from the priority deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | swap (priority_deque< Type, Sequence, Compare > &) |
Moves the elements from this deque into another, and vice-versa. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_reference | maximum (void) const |
Accesses a maximal element in the deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_reference | minimum (void) const |
Accesses a minimal element in the deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_reference | top (void) const |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_reference | bottom (void) const |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | pop_top (void) |
Removes a maximal element from the deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | pop_bottom (void) |
Removes a minimal element from the deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | pop (void) |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE bool | empty (void) const |
Returns true if the priority deque is empty, false if it is not. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE size_type | size (void) const |
Returns the number of elements in the priority deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE size_type | max_size (void) const |
Returns the maximum number of elements that can be contained. More... | |
template<typename InputIterator > | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | merge (InputIterator first, InputIterator last) |
Merges a sequence of elements into the priority deque. More... | |
template<typename SourceContainer > | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | merge (const SourceContainer &source) |
Merges a container's elements into the priority deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_iterator | begin (void) const |
Returns a const iterator at the beginning of the sequence. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const_iterator | end (void) const |
Returns a const iterator past the end of the sequence. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void | update (const_iterator, const value_type &) |
Modifies a specified element of the deque. More... | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE 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 | |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE container_type & | sequence (void) |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE const container_type & | sequence (void) const |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE value_compare & | compare (void) |
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE 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 nvbio::priority_deque< Type, Sequence, Compare >::const_iterator |
May be used to examine, but not modify, elements in the deque.
Definition at line 168 of file priority_deque.h.
typedef pointer nvbio::priority_deque< Type, Sequence, Compare >::const_pointer |
Definition at line 166 of file priority_deque.h.
typedef container_type::const_reference nvbio::priority_deque< Type, Sequence, Compare >::const_reference |
May be used to examine, but not modify, an element in the deque.
Definition at line 163 of file priority_deque.h.
typedef Sequence nvbio::priority_deque< Type, Sequence, Compare >::container_type |
Underlying container type.
Definition at line 157 of file priority_deque.h.
typedef container_type::difference_type nvbio::priority_deque< Type, Sequence, Compare >::difference_type |
STL Container specifies that this is a signed integral type.
Definition at line 171 of file priority_deque.h.
typedef const_iterator nvbio::priority_deque< Type, Sequence, Compare >::iterator |
Definition at line 169 of file priority_deque.h.
typedef container_type::pointer nvbio::priority_deque< Type, Sequence, Compare >::pointer |
Definition at line 165 of file priority_deque.h.
typedef container_type::reference nvbio::priority_deque< Type, Sequence, Compare >::reference |
Definition at line 164 of file priority_deque.h.
typedef container_type::size_type nvbio::priority_deque< Type, Sequence, Compare >::size_type |
STL Container specifies that this is an unsigned integral type.
Definition at line 161 of file priority_deque.h.
typedef Compare nvbio::priority_deque< Type, Sequence, Compare >::value_compare |
Definition at line 159 of file priority_deque.h.
typedef container_type::value_type nvbio::priority_deque< Type, Sequence, Compare >::value_type |
Definition at line 158 of file priority_deque.h.
enum nvbio::priority_deque::Constructed |
Enumerator | |
---|---|
CONSTRUCTED |
Definition at line 173 of file priority_deque.h.
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE nvbio::priority_deque< Type, Sequence, Compare >::priority_deque | ( | InputIterator | first, |
InputIterator | last, | ||
const Compare & | = Compare() , |
||
const Sequence & | = Sequence() |
||
) |
|
inline |
O(1) Creates a new priority deque from an already heapified container
Definition at line 194 of file priority_deque.h.
|
inline |
Returns a const iterator at the beginning of the sequence.
Definition at line 263 of file priority_deque.h.
|
inline |
Removes all elements from the priority deque.
Definition at line 244 of file priority_deque.h.
|
inlineprotected |
Definition at line 294 of file priority_deque.h.
|
inlineprotected |
Definition at line 296 of file priority_deque.h.
|
inline |
Returns true if the priority deque is empty, false if it is not.
Definition at line 232 of file priority_deque.h.
|
inline |
Returns a const iterator past the end of the sequence.
Definition at line 266 of file priority_deque.h.
|
inline |
Returns the maximum number of elements that can be contained.
Definition at line 238 of file priority_deque.h.
NVBIO_FORCEINLINE NVBIO_HOST_DEVICE void nvbio::priority_deque< Type, Sequence, Compare >::merge | ( | InputIterator | first, |
InputIterator | last | ||
) |
Merges a sequence of elements into the priority deque.
|
inline |
Merges a container's elements into the priority deque.
Definition at line 256 of file priority_deque.h.
|
inlineprotected |
Definition at line 290 of file priority_deque.h.
|
inlineprotected |
Definition at line 292 of file priority_deque.h.
|
inline |
Returns the number of elements in the priority deque.
Definition at line 235 of file priority_deque.h.
|
static |
Definition at line 277 of file priority_deque.h.
|
static |
Definition at line 279 of file priority_deque.h.
|
static |
Definition at line 285 of file priority_deque.h.
|
static |
Definition at line 281 of file priority_deque.h.
|
static |
Definition at line 283 of file priority_deque.h.