41 #ifdef PB_DS_CLASS_C_DEC
45 hash_standard_resize_policy()
46 : m_size(Size_Policy::get_nearest_larger_size(1))
47 { trigger_policy_base::notify_externally_resized(m_size); }
51 hash_standard_resize_policy(
const Size_Policy& r_size_policy)
52 : Size_Policy(r_size_policy), m_size(Size_Policy::get_nearest_larger_size(1))
53 { trigger_policy_base::notify_externally_resized(m_size); }
57 hash_standard_resize_policy(
const Size_Policy& r_size_policy,
58 const Trigger_Policy& r_trigger_policy)
59 : Size_Policy(r_size_policy), Trigger_Policy(r_trigger_policy),
60 m_size(Size_Policy::get_nearest_larger_size(1))
61 { trigger_policy_base::notify_externally_resized(m_size); }
65 ~hash_standard_resize_policy()
71 swap(PB_DS_CLASS_C_DEC& other)
73 trigger_policy_base::swap(other);
74 size_policy_base::swap(other);
75 std::swap(m_size, other.m_size);
81 notify_find_search_start()
82 { trigger_policy_base::notify_find_search_start(); }
87 notify_find_search_collision()
88 { trigger_policy_base::notify_find_search_collision(); }
93 notify_find_search_end()
94 { trigger_policy_base::notify_find_search_end(); }
99 notify_insert_search_start()
100 { trigger_policy_base::notify_insert_search_start(); }
105 notify_insert_search_collision()
106 { trigger_policy_base::notify_insert_search_collision(); }
111 notify_insert_search_end()
112 { trigger_policy_base::notify_insert_search_end(); }
117 notify_erase_search_start()
118 { trigger_policy_base::notify_erase_search_start(); }
123 notify_erase_search_collision()
124 { trigger_policy_base::notify_erase_search_collision(); }
129 notify_erase_search_end()
130 { trigger_policy_base::notify_erase_search_end(); }
135 notify_inserted(size_type num_e)
136 { trigger_policy_base::notify_inserted(num_e); }
141 notify_erased(size_type num_e)
142 { trigger_policy_base::notify_erased(num_e); }
148 { trigger_policy_base::notify_cleared(); }
153 is_resize_needed()
const
154 {
return trigger_policy_base::is_resize_needed(); }
157 typename PB_DS_CLASS_C_DEC::size_type
159 get_new_size(size_type size, size_type num_used_e)
const
161 if (trigger_policy_base::is_grow_needed(size, num_used_e))
162 return size_policy_base::get_nearest_larger_size(size);
163 return size_policy_base::get_nearest_smaller_size(size);
169 notify_resized(size_type new_size)
171 trigger_policy_base::notify_resized(new_size);
176 inline typename PB_DS_CLASS_C_DEC::size_type
178 get_actual_size()
const
180 PB_DS_STATIC_ASSERT(access, external_size_access);
187 resize(size_type new_size)
189 PB_DS_STATIC_ASSERT(access, external_size_access);
190 size_type actual_size = size_policy_base::get_nearest_larger_size(1);
191 while (actual_size < new_size)
193 const size_type pot = size_policy_base::get_nearest_larger_size(actual_size);
195 if (pot == actual_size && pot < new_size)
196 __throw_resize_error();
203 const size_type old_size = m_size;
206 do_resize(actual_size - 1);
208 __catch(insert_error& )
211 __throw_resize_error();
216 __throw_exception_again;
235 const Trigger_Policy&
237 get_trigger_policy()
const
249 get_size_policy()
const