Fermat
Public Types | Public Methods | Public Members | List of all members
cugar::priority_queue< Key, Container, Compare > Struct Template Reference

Detailed description

template<typename Key, typename Container, typename Compare>
struct cugar::priority_queue< Key, Container, Compare >

A priority queue adaptor, that can be built on top of any user-provided container

Template Parameters
Keythe key type
Containerthe underlying container used to hold keys, must implement push_back(), size(), resize(), clear()
Comparethe comparison binary functor, Compare(a,b) == true iff a < b

#include <priority_queue.h>

Public Types

typedef Key value_type
 
typedef Container container_type
 
typedef container_type::const_iterator const_iterator
 
typedef const_iterator iterator
 

Public Methods

CUGAR_FORCEINLINE CUGAR_HOST_DEVICE priority_queue (Container cont=Container(), const Compare cmp=Compare())
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool empty () const
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE uint32 size () const
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void push (const Key key)
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void pop ()
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Key & top ()
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Key top () const
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const Key & operator[] (const uint32 i) const
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void clear ()
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const_iterator begin () const
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE iterator begin ()
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const_iterator end () const
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE iterator end ()
 
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE iterator upper_bound (const Key &x)
 

Public Members

uint32 m_size
 
Container m_queue
 
Compare m_cmp
 

Constructor & Destructor Documentation

◆ priority_queue()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE cugar::priority_queue< Key, Container, Compare >::priority_queue ( Container  cont = Container(),
const Compare  cmp = Compare() 
)

constructor

Member Function Documentation

◆ begin() [1/2]

template<typename Key, typename Container, typename Compare>
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const_iterator cugar::priority_queue< Key, Container, Compare >::begin ( ) const
inline

starting iterator

◆ begin() [2/2]

template<typename Key, typename Container, typename Compare>
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE iterator cugar::priority_queue< Key, Container, Compare >::begin ( )
inline

starting iterator

◆ clear()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void cugar::priority_queue< Key, Container, Compare >::clear ( )

clear the queue

◆ empty()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool cugar::priority_queue< Key, Container, Compare >::empty ( ) const

is queue empty?

◆ end() [1/2]

template<typename Key, typename Container, typename Compare>
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const_iterator cugar::priority_queue< Key, Container, Compare >::end ( ) const
inline

ending iterator

◆ end() [2/2]

template<typename Key, typename Container, typename Compare>
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE iterator cugar::priority_queue< Key, Container, Compare >::end ( )
inline

ending iterator

◆ operator[]()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const Key & cugar::priority_queue< Key, Container, Compare >::operator[] ( const uint32  i) const

return the i-th element in the heap

◆ pop()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void cugar::priority_queue< Key, Container, Compare >::pop ( )

pop an element

◆ push()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void cugar::priority_queue< Key, Container, Compare >::push ( const Key  key)

push an element

◆ size()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE uint32 cugar::priority_queue< Key, Container, Compare >::size ( ) const

return queue size

◆ top() [1/2]

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Key & cugar::priority_queue< Key, Container, Compare >::top ( )

top of the queue

◆ top() [2/2]

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Key cugar::priority_queue< Key, Container, Compare >::top ( ) const

top of the queue

◆ upper_bound()

template<typename Key , typename Container , typename Compare >
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE priority_queue< Key, Container, Compare >::iterator cugar::priority_queue< Key, Container, Compare >::upper_bound ( const Key &  x)

locate the largest element v such that v <= x; return end() if no such element exists


The documentation for this struct was generated from the following files: