32 template <
typename Key,
typename Container,
typename Compare>
34 : m_size(0), m_queue(cont), m_cmp(cmp)
37 assert( m_queue.empty() == true );
42 template <
typename Key,
typename Container,
typename Compare>
50 template <
typename Key,
typename Container,
typename Compare>
58 template <
typename Key,
typename Container,
typename Compare>
63 m_queue.resize( m_size+1 );
69 if (! m_cmp( m_queue[p], key ))
72 m_queue[r] = m_queue[p];
80 template <
typename Key,
typename Container,
typename Compare>
83 Key dn = m_queue[m_size--];
84 m_queue.resize( m_size+1 );
92 if (r < m_size && m_cmp( m_queue[r], m_queue[r+1] )) r++;
93 if (! m_cmp( dn, m_queue[r] ))
96 m_queue[p] = m_queue[r];
100 m_queue[p] = m_queue[m_size+1];
105 template <
typename Key,
typename Container,
typename Compare>
113 template <
typename Key,
typename Container,
typename Compare>
121 template <
typename Key,
typename Container,
typename Compare>
129 template <
typename Key,
typename Container,
typename Compare>
139 template <
typename Key,
typename Container,
typename Compare>
140 CUGAR_FORCEINLINE CUGAR_HOST_DEVICE
typename priority_queue<Key,Container,Compare>::iterator
146 for (uint32 j = 1; j <
size()+1; ++j)
148 if (!m_cmp( x, m_queue[j] ))
150 if (max_i == 0 || !m_cmp( m_queue[j], max ))
162 return begin() + max_i-1;
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const_iterator begin() const
Definition: priority_queue.h:135
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE uint32 size() const
Definition: priority_queue_inline.h:51
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE Key & top()
Definition: priority_queue_inline.h:106
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const Key & operator[](const uint32 i) const
Definition: priority_queue_inline.h:122
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE priority_queue(Container cont=Container(), const Compare cmp=Compare())
Definition: priority_queue_inline.h:33
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void push(const Key key)
Definition: priority_queue_inline.h:59
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE const_iterator end() const
Definition: priority_queue.h:145
Define a vector_view POD type and plain_view() for std::vector.
Definition: diff.h:38
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE iterator upper_bound(const Key &x)
Definition: priority_queue_inline.h:141
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE bool empty() const
Definition: priority_queue_inline.h:43
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void clear()
Definition: priority_queue_inline.h:130
CUGAR_FORCEINLINE CUGAR_HOST_DEVICE void pop()
Definition: priority_queue_inline.h:81