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>
141 const uint32 msb = 1u << (
sizeof(i) * 8u - 1u);
142 return msb >>
lzc(i);
148 return 1u << (
sizeof(i) * 8u -
lzc(i) - 1u);
161 template <
typename Key,
typename Container,
typename Compare>
168 for (
uint32 j = 1; j < size()+1; ++j)
170 if (!m_cmp( x, m_queue[j] ))
172 if (max_i == 0 || !m_cmp( m_queue[j], max ))
184 return begin() + max_i-1;
193 while(!stop && i > 0)
200 for(
uint32 j = i; j < i + num_nodes; j++)
202 if (!m_cmp( x, m_queue[j] ))
208 if (max_i == 0 || !m_cmp( m_queue[j], max ))
227 return begin() + max_i-1;