41 #ifndef PB_DS_HASH_POLICY_HPP 42 #define PB_DS_HASH_POLICY_HPP 56 #define PB_DS_CLASS_T_DEC template<typename Size_Type> 57 #define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type> 60 template<
typename Size_Type = std::
size_t>
64 typedef Size_Type size_type;
67 swap(PB_DS_CLASS_C_DEC& other);
77 #undef PB_DS_CLASS_T_DEC 78 #undef PB_DS_CLASS_C_DEC 80 #define PB_DS_CLASS_T_DEC template<typename Size_Type> 81 #define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type> 84 template<
typename Size_Type = std::
size_t>
88 typedef Size_Type size_type;
91 swap(PB_DS_CLASS_C_DEC& other);
101 #undef PB_DS_CLASS_T_DEC 102 #undef PB_DS_CLASS_C_DEC 104 #define PB_DS_CLASS_T_DEC template<typename Size_Type> 105 #define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type> 108 template<
typename Size_Type = std::
size_t>
116 typedef Size_Type size_type;
119 swap(PB_DS_CLASS_C_DEC& other);
123 notify_resized(size_type size);
133 #undef PB_DS_CLASS_T_DEC 134 #undef PB_DS_CLASS_C_DEC 136 #define PB_DS_CLASS_T_DEC template<typename Size_Type> 137 #define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type> 140 template<
typename Size_Type = std::
size_t>
145 typedef Size_Type size_type;
148 swap(PB_DS_CLASS_C_DEC& other);
152 notify_resized(size_type size);
165 #undef PB_DS_CLASS_T_DEC 166 #undef PB_DS_CLASS_C_DEC 168 #define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type> 169 #define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger<External_Load_Access, Size_Type> 170 #define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base<Size_Type, External_Load_Access> 174 template<
bool External_Load_Access = false,
typename Size_Type = std::
size_t>
178 typedef Size_Type size_type;
185 external_load_access = External_Load_Access
192 float load_max = 0.5);
211 notify_insert_search_start();
214 notify_insert_search_collision();
217 notify_insert_search_end();
220 notify_find_search_start();
223 notify_find_search_collision();
226 notify_find_search_end();
229 notify_erase_search_start();
232 notify_erase_search_collision();
235 notify_erase_search_end();
240 notify_inserted(size_type num_entries);
243 notify_erased(size_type num_entries);
252 notify_resized(size_type new_size);
255 notify_externally_resized(size_type new_size);
258 is_resize_needed()
const;
261 is_grow_needed(size_type size, size_type num_entries)
const;
265 do_resize(size_type new_size);
267 typedef PB_DS_SIZE_BASE_C_DEC size_base;
269 #ifdef _GLIBCXX_DEBUG 271 assert_valid(
const char* file,
int line)
const;
276 size_type m_next_shrink_size;
277 size_type m_next_grow_size;
278 bool m_resize_needed;
283 #undef PB_DS_CLASS_T_DEC 284 #undef PB_DS_CLASS_C_DEC 285 #undef PB_DS_SIZE_BASE_C_DEC 287 #define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type> 288 #define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger<External_Load_Access, Size_Type> 292 template<
bool External_Load_Access = false,
typename Size_Type = std::
size_t>
296 typedef Size_Type size_type;
303 external_load_access = External_Load_Access
311 swap(PB_DS_CLASS_C_DEC& other);
319 set_load(
float load);
324 notify_insert_search_start();
328 notify_insert_search_collision();
332 notify_insert_search_end();
336 notify_find_search_start();
340 notify_find_search_collision();
344 notify_find_search_end();
348 notify_erase_search_start();
352 notify_erase_search_collision();
356 notify_erase_search_end();
360 notify_inserted(size_type num_entries);
364 notify_erased(size_type num_entries);
373 notify_resized(size_type new_size);
377 notify_externally_resized(size_type new_size);
381 is_resize_needed()
const;
386 is_grow_needed(size_type size, size_type num_entries)
const;
393 calc_resize_needed();
399 bool m_resize_needed;
404 #undef PB_DS_CLASS_T_DEC 405 #undef PB_DS_CLASS_C_DEC 407 #define PB_DS_CLASS_T_DEC template<typename Size_Type> 408 #define PB_DS_CLASS_C_DEC hash_exponential_size_policy<Size_Type> 412 template<
typename Size_Type = std::
size_t>
416 typedef Size_Type size_type;
423 size_type grow_factor = 2);
426 swap(PB_DS_CLASS_C_DEC& other);
430 get_nearest_larger_size(size_type size)
const;
433 get_nearest_smaller_size(size_type size)
const;
436 size_type m_start_size;
437 size_type m_grow_factor;
442 #undef PB_DS_CLASS_T_DEC 443 #undef PB_DS_CLASS_C_DEC 445 #define PB_DS_CLASS_T_DEC 446 #define PB_DS_CLASS_C_DEC hash_prime_size_policy 462 swap(PB_DS_CLASS_C_DEC& other);
466 get_nearest_larger_size(size_type size)
const;
469 get_nearest_smaller_size(size_type size)
const;
472 size_type m_start_size;
477 #undef PB_DS_CLASS_T_DEC 478 #undef PB_DS_CLASS_C_DEC 480 #define PB_DS_CLASS_T_DEC template<typename Size_Policy, typename Trigger_Policy, bool External_Size_Access, typename Size_Type> 482 #define PB_DS_CLASS_C_DEC hash_standard_resize_policy<Size_Policy, Trigger_Policy, External_Size_Access, Size_Type> 485 template<
typename Size_Policy = hash_exponential_size_policy<>,
486 typename Trigger_Policy = hash_load_check_re
size_trigger<>,
487 bool External_Size_Access = false,
488 typename Size_Type = std::
size_t>
490 :
public Size_Policy,
public Trigger_Policy
493 typedef Size_Type size_type;
494 typedef Trigger_Policy trigger_policy;
495 typedef Size_Policy size_policy;
499 external_size_access = External_Size_Access
514 const Trigger_Policy& r_trigger_policy);
520 swap(PB_DS_CLASS_C_DEC& other);
528 get_size_policy()
const;
532 get_trigger_policy();
535 const Trigger_Policy&
536 get_trigger_policy()
const;
540 get_actual_size()
const;
546 resize(size_type suggested_new_size);
550 notify_insert_search_start();
553 notify_insert_search_collision();
556 notify_insert_search_end();
559 notify_find_search_start();
562 notify_find_search_collision();
565 notify_find_search_end();
568 notify_erase_search_start();
571 notify_erase_search_collision();
574 notify_erase_search_end();
577 notify_inserted(size_type num_e);
580 notify_erased(size_type num_e);
586 notify_resized(size_type new_size);
589 is_resize_needed()
const;
596 get_new_size(size_type size, size_type num_used_e)
const;
601 do_resize(size_type new_size);
603 typedef Trigger_Policy trigger_policy_base;
605 typedef Size_Policy size_policy_base;
612 #undef PB_DS_CLASS_T_DEC 613 #undef PB_DS_CLASS_C_DEC
GNU extensions for policy-based data structures for public use.
A mask range-hashing class (uses a bitmask).
A size policy whose sequence of sizes form a nearly-exponential sequence of primes.
A probe sequence policy using square increments.
A resize policy which delegates operations to size and trigger policies.
A resize trigger policy based on a load check. It keeps the load factor between some load factors loa...
size_type operator()(size_type i) const
Returns the i-th offset from the hash value.
A resize trigger policy based on collision checks. It keeps the simulated load factor lower than some...
A probe sequence policy using fixed increments.
A mod range-hashing class (uses the modulo function).
A size policy whose sequence of sizes form an exponential sequence (typically powers of 2...
Struct holding two objects of arbitrary type.
std::size_t size_type
Size type.