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>
127 rc(
const rc<_Node, _Alloc>& other) : m_over_top(0)
128 { PB_DS_ASSERT_VALID((*
this)) }
130 template<
typename _Node,
typename _Alloc>
133 swap(rc<_Node, _Alloc>& other)
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]);
143 std::swap(m_over_top, other.m_over_top);
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>
221 assert_valid(
const char* __file,
int __line)
const 222 { PB_DS_DEBUG_VERIFY(m_over_top < max_entries); }
225 #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_ 226 template<
typename _Node,
typename _Alloc>
232 for (size_type i = 0; i < m_over_top; ++i)
GNU extensions for policy-based data structures for public use.
Redundant binary counter.
ostream cerr
Linked to standard output.
ISO C++ entities toplevel namespace is std.
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
Write a newline and flush the stream.
ostream cout
Linked to standard input.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
_GLIBCXX14_CONSTEXPR const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does.