43 typename PB_DS_CLASS_C_DEC::entry_allocator
44 PB_DS_CLASS_C_DEC::s_entry_allocator;
50 copy_from_range(It first_it, It last_it)
52 while (first_it != last_it)
53 insert(*(first_it++));
59 : ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),
60 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
61 m_entries(s_entry_allocator.allocate(m_num_e))
64 PB_DS_ASSERT_VALID((*
this))
69 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn)
70 : ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
71 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
72 m_entries(s_entry_allocator.allocate(m_num_e))
75 PB_DS_ASSERT_VALID((*
this))
80 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn)
81 : hash_eq_fn_base(r_eq_fn),
82 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
83 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
84 m_entries(s_entry_allocator.allocate(m_num_e))
87 PB_DS_ASSERT_VALID((*
this))
92 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn,
93 const Comb_Probe_Fn& r_comb_hash_fn)
94 : hash_eq_fn_base(r_eq_fn),
95 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
96 r_hash_fn, r_comb_hash_fn),
97 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
98 m_entries(s_entry_allocator.allocate(m_num_e))
101 PB_DS_ASSERT_VALID((*
this))
106 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn,
107 const Comb_Probe_Fn& comb_hash_fn,
const Probe_Fn& prober)
108 : hash_eq_fn_base(r_eq_fn),
109 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
110 r_hash_fn, comb_hash_fn, prober),
111 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
112 m_entries(s_entry_allocator.allocate(m_num_e))
115 PB_DS_ASSERT_VALID((*
this))
120 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn,
121 const Comb_Probe_Fn& comb_hash_fn,
const Probe_Fn& prober,
122 const Resize_Policy& r_resize_policy)
123 : hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),
124 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
125 r_hash_fn, comb_hash_fn, prober),
126 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
127 m_entries(s_entry_allocator.allocate(m_num_e))
130 PB_DS_ASSERT_VALID((*
this))
135 PB_DS_GP_HASH_NAME(
const PB_DS_CLASS_C_DEC& other) :
136 #ifdef _GLIBCXX_DEBUG
139 hash_eq_fn_base(other),
141 ranged_probe_fn_base(other),
142 m_num_e(other.m_num_e),
143 m_num_used_e(other.m_num_used_e),
144 m_entries(s_entry_allocator.allocate(m_num_e))
146 for (size_type i = 0; i < m_num_e; ++i)
147 m_entries[i].m_stat = (entry_status)empty_entry_status;
151 for (size_type i = 0; i < m_num_e; ++i)
153 m_entries[i].m_stat = other.m_entries[i].m_stat;
154 if (m_entries[i].m_stat == valid_entry_status)
155 new (m_entries + i) entry(other.m_entries[i]);
161 __throw_exception_again;
163 PB_DS_ASSERT_VALID((*
this))
168 ~PB_DS_GP_HASH_NAME()
169 { deallocate_all(); }
174 swap(PB_DS_CLASS_C_DEC& other)
176 PB_DS_ASSERT_VALID((*
this))
177 PB_DS_ASSERT_VALID(other)
178 std::
swap(m_num_e, other.m_num_e);
179 std::
swap(m_num_used_e, other.m_num_used_e);
180 std::
swap(m_entries, other.m_entries);
181 ranged_probe_fn_base::
swap(other);
182 hash_eq_fn_base::
swap(other);
183 resize_base::
swap(other);
184 _GLIBCXX_DEBUG_ONLY(debug_base::
swap(other));
185 PB_DS_ASSERT_VALID((*this))
186 PB_DS_ASSERT_VALID(other)
195 erase_all_valid_entries(m_entries, m_num_e);
196 s_entry_allocator.deallocate(m_entries, m_num_e);
202 erase_all_valid_entries(entry_array a_entries_resized, size_type len)
204 for (size_type pos = 0; pos < len; ++pos)
206 entry_pointer p_e = &a_entries_resized[pos];
207 if (p_e->m_stat == valid_entry_status)
208 p_e->m_value.~value_type();
217 Resize_Policy::notify_resized(m_num_e);
218 Resize_Policy::notify_cleared();
219 ranged_probe_fn_base::notify_resized(m_num_e);
220 for (size_type i = 0; i < m_num_e; ++i)
221 m_entries[i].m_stat = empty_entry_status;
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.