44 typename PB_DS_CLASS_C_DEC::entry_allocator
45 PB_DS_CLASS_C_DEC::s_entry_allocator;
51 copy_from_range(It first_it, It last_it)
53 while (first_it != last_it)
54 insert(*(first_it++));
60 : ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),
61 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
62 m_entries(s_entry_allocator.allocate(m_num_e))
65 PB_DS_ASSERT_VALID((*
this))
70 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn)
71 : ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
72 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
73 m_entries(s_entry_allocator.allocate(m_num_e))
76 PB_DS_ASSERT_VALID((*
this))
81 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn)
82 : hash_eq_fn_base(r_eq_fn),
83 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),
84 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
85 m_entries(s_entry_allocator.allocate(m_num_e))
88 PB_DS_ASSERT_VALID((*
this))
93 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn,
94 const Comb_Probe_Fn& r_comb_hash_fn)
95 : hash_eq_fn_base(r_eq_fn),
96 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
97 r_hash_fn, r_comb_hash_fn),
98 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
99 m_entries(s_entry_allocator.allocate(m_num_e))
102 PB_DS_ASSERT_VALID((*
this))
107 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn,
108 const Comb_Probe_Fn& comb_hash_fn,
const Probe_Fn& prober)
109 : hash_eq_fn_base(r_eq_fn),
110 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
111 r_hash_fn, comb_hash_fn, prober),
112 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
113 m_entries(s_entry_allocator.allocate(m_num_e))
116 PB_DS_ASSERT_VALID((*
this))
121 PB_DS_GP_HASH_NAME(
const Hash_Fn& r_hash_fn,
const Eq_Fn& r_eq_fn,
122 const Comb_Probe_Fn& comb_hash_fn,
const Probe_Fn& prober,
123 const Resize_Policy& r_resize_policy)
124 : hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),
125 ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
126 r_hash_fn, comb_hash_fn, prober),
127 m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
128 m_entries(s_entry_allocator.allocate(m_num_e))
131 PB_DS_ASSERT_VALID((*
this))
136 PB_DS_GP_HASH_NAME(
const PB_DS_CLASS_C_DEC& other) :
137 #ifdef _GLIBCXX_DEBUG
140 hash_eq_fn_base(other),
142 ranged_probe_fn_base(other),
143 m_num_e(other.m_num_e),
144 m_num_used_e(other.m_num_used_e),
145 m_entries(s_entry_allocator.allocate(m_num_e))
147 for (size_type i = 0; i < m_num_e; ++i)
148 m_entries[i].m_stat = (entry_status)empty_entry_status;
152 for (size_type i = 0; i < m_num_e; ++i)
154 m_entries[i].m_stat = other.m_entries[i].m_stat;
155 if (m_entries[i].m_stat == valid_entry_status)
156 new (m_entries + i) entry(other.m_entries[i]);
162 __throw_exception_again;
164 PB_DS_ASSERT_VALID((*
this))
169 ~PB_DS_GP_HASH_NAME()
170 { deallocate_all(); }
175 swap(PB_DS_CLASS_C_DEC& other)
177 PB_DS_ASSERT_VALID((*
this))
178 PB_DS_ASSERT_VALID(other)
179 std::swap(m_num_e, other.m_num_e);
180 std::swap(m_num_used_e, other.m_num_used_e);
181 std::swap(m_entries, other.m_entries);
182 ranged_probe_fn_base::swap(other);
183 hash_eq_fn_base::swap(other);
184 resize_base::swap(other);
185 _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
186 PB_DS_ASSERT_VALID((*this))
187 PB_DS_ASSERT_VALID(other)
196 erase_all_valid_entries(m_entries, m_num_e);
197 s_entry_allocator.deallocate(m_entries, m_num_e);
203 erase_all_valid_entries(entry_array a_entries_resized, size_type len)
205 for (size_type pos = 0; pos < len; ++pos)
207 entry_pointer p_e = &a_entries_resized[pos];
208 if (p_e->m_stat == valid_entry_status)
209 p_e->m_value.~value_type();
218 Resize_Policy::notify_resized(m_num_e);
219 Resize_Policy::notify_cleared();
220 ranged_probe_fn_base::notify_resized(m_num_e);
221 for (size_type i = 0; i < m_num_e; ++i)
222 m_entries[i].m_stat = empty_entry_status;