49 template<
typename _Node,
typename _Alloc>
53 typedef _Alloc allocator_type;
54 typedef typename allocator_type::size_type size_type;
57 typedef typename _Alloc::template rebind<node> __rebind_n;
58 typedef typename __rebind_n::other::pointer node_pointer;
60 typedef typename _Alloc::template rebind<node_pointer> __rebind_np;
62 typedef typename __rebind_np::other::pointer entry_pointer;
63 typedef typename __rebind_np::other::const_pointer entry_const_pointer;
67 max_entries =
sizeof(size_type) << 3
71 typedef node_pointer entry;
72 typedef entry_const_pointer const_iterator;
105 #ifdef _GLIBCXX_DEBUG
107 assert_valid(
const char*,
int)
const;
110 #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
116 node_pointer m_a_entries[max_entries];
117 size_type m_over_top;
120 template<
typename _Node,
typename _Alloc>
123 { PB_DS_ASSERT_VALID((*
this)) }
125 template<
typename _Node,
typename _Alloc>
128 { PB_DS_ASSERT_VALID((*
this)) }
130 template<
typename _Node,
typename _Alloc>
135 PB_DS_ASSERT_VALID((*
this))
136 PB_DS_ASSERT_VALID(other)
138 const size_type over_top =
std::max(m_over_top, other.m_over_top);
140 for (size_type i = 0; i < over_top; ++i)
141 std::swap(m_a_entries[i], other.m_a_entries[i]);
144 PB_DS_ASSERT_VALID((*
this))
145 PB_DS_ASSERT_VALID(other)
148 template<
typename _Node,
typename _Alloc>
153 PB_DS_ASSERT_VALID((*
this))
154 _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries);
155 m_a_entries[m_over_top++] = p_nd;
156 PB_DS_ASSERT_VALID((*
this))
159 template<
typename _Node,
typename _Alloc>
164 PB_DS_ASSERT_VALID((*
this))
165 _GLIBCXX_DEBUG_ASSERT(!empty());
167 PB_DS_ASSERT_VALID((*
this))
170 template<
typename _Node,
typename _Alloc>
171 inline typename rc<_Node, _Alloc>::node_pointer
175 PB_DS_ASSERT_VALID((*
this))
176 _GLIBCXX_DEBUG_ASSERT(!empty());
177 return *(m_a_entries + m_over_top - 1);
180 template<
typename _Node,
typename _Alloc>
185 PB_DS_ASSERT_VALID((*
this))
186 return m_over_top == 0;
189 template<
typename _Node,
typename _Alloc>
190 inline typename rc<_Node, _Alloc>::size_type
193 {
return m_over_top; }
195 template<
typename _Node,
typename _Alloc>
200 PB_DS_ASSERT_VALID((*
this))
202 PB_DS_ASSERT_VALID((*
this))
205 template<
typename _Node,
typename _Alloc>
206 const typename rc<_Node, _Alloc>::const_iterator
209 {
return& m_a_entries[0]; }
211 template<
typename _Node,
typename _Alloc>
212 const typename rc<_Node, _Alloc>::const_iterator
215 {
return& m_a_entries[m_over_top]; }
217 #ifdef _GLIBCXX_DEBUG
218 template<
typename _Node,
typename _Alloc>
222 { PB_DS_DEBUG_VERIFY(m_over_top < max_entries); }
225 #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_
226 template<
typename _Node,
typename _Alloc>
231 std::cout <<
"rc" << std::endl;
232 for (size_type i = 0; i < m_over_top; ++i)
233 std::cerr << m_a_entries[i] << std::endl;
234 std::cout << std::endl;
Redundant binary counter.
GNU extensions for policy-based data structures for public use.
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.