GNU g++  v5.2.1
GNU Standard C++
__gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type > Class Template Reference

A resize trigger policy based on collision checks. More...

#include <hash_policy.hpp>

Collaboration diagram for __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >:

Public Types

enum  { external_load_access = External_Load_Access }
 
typedef Size_Type size_type
 

Public Member Functions

 cc_hash_max_collision_check_resize_trigger (float load=0.5)
 Default constructor, or constructor taking load, a __load factor which it will attempt to maintain. More...
 
float get_load () const
 Returns the current load. More...
 
void set_load (float load)
 Sets the load; does not resize the container. More...
 
void swap (cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type > &other)
 

Protected Member Functions

bool is_grow_needed (size_type size, size_type num_entries) const
 Queries whether a grow is needed. More...
 
bool is_resize_needed () const
 Queries whether a resize is needed. More...
 
void notify_cleared ()
 Notifies the table was cleared. More...
 
void notify_erase_search_collision ()
 Notifies a search encountered a collision. More...
 
void notify_erase_search_end ()
 Notifies a search ended. More...
 
void notify_erase_search_start ()
 Notifies an erase search started. More...
 
void notify_erased (size_type num_entries)
 Notifies an element was erased. More...
 
void notify_externally_resized (size_type new_size)
 Notifies the table was resized externally. More...
 
void notify_find_search_collision ()
 Notifies a search encountered a collision. More...
 
void notify_find_search_end ()
 Notifies a search ended. More...
 
void notify_find_search_start ()
 Notifies a find search started. More...
 
void notify_insert_search_collision ()
 Notifies a search encountered a collision. More...
 
void notify_insert_search_end ()
 Notifies a search ended. More...
 
void notify_insert_search_start ()
 Notifies an insert search started. More...
 
void notify_inserted (size_type num_entries)
 Notifies an element was inserted. More...
 
void notify_resized (size_type new_size)
 Notifies the table was resized as a result of this object's signifying that a resize is needed. More...
 

Private Member Functions

void calc_max_num_coll ()
 
void calc_resize_needed ()
 

Private Attributes

float m_load
 
size_type m_max_col
 
size_type m_num_col
 
bool m_resize_needed
 
size_type m_size
 

Detailed Description

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
class __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >

A resize trigger policy based on collision checks.

It keeps the simulated load factor lower than some given load factor.

Member Typedef Documentation

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
typedef Size_Type __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::size_type

Member Enumeration Documentation

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
anonymous enum
Enumerator
external_load_access 

Specifies whether the load factor can be accessed externally.

The two options have different trade-offs in terms of flexibility, genericity, and encapsulation.

Constructor & Destructor Documentation

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
__gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::cc_hash_max_collision_check_resize_trigger ( float  load = 0.5)

Default constructor, or constructor taking load, a __load factor which it will attempt to maintain.

Member Function Documentation

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::calc_max_num_coll ( )
private
template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::calc_resize_needed ( )
inlineprivate
template<bool External_Load_Access = false, typename Size_Type = std::size_t>
float __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::get_load ( ) const
inline

Returns the current load.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
bool __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::is_grow_needed ( size_type  size,
size_type  num_entries 
) const
inlineprotected

Queries whether a grow is needed.

This method is called only if this object indicated is needed.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
bool __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::is_resize_needed ( ) const
inlineprotected

Queries whether a resize is needed.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_cleared ( )
protected

Notifies the table was cleared.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_erase_search_collision ( )
inlineprotected

Notifies a search encountered a collision.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_erase_search_end ( )
inlineprotected

Notifies a search ended.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_erase_search_start ( )
inlineprotected

Notifies an erase search started.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_erased ( size_type  num_entries)
inlineprotected

Notifies an element was erased.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_externally_resized ( size_type  new_size)
protected

Notifies the table was resized externally.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_find_search_collision ( )
inlineprotected

Notifies a search encountered a collision.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_find_search_end ( )
inlineprotected

Notifies a search ended.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_find_search_start ( )
inlineprotected

Notifies a find search started.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_insert_search_collision ( )
inlineprotected

Notifies a search encountered a collision.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_insert_search_end ( )
inlineprotected

Notifies a search ended.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_insert_search_start ( )
inlineprotected

Notifies an insert search started.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_inserted ( size_type  num_entries)
inlineprotected

Notifies an element was inserted.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::notify_resized ( size_type  new_size)
protected

Notifies the table was resized as a result of this object's signifying that a resize is needed.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::set_load ( float  load)

Sets the load; does not resize the container.

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
void __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::swap ( cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type > &  other)

Member Data Documentation

template<bool External_Load_Access = false, typename Size_Type = std::size_t>
float __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::m_load
private
template<bool External_Load_Access = false, typename Size_Type = std::size_t>
size_type __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::m_max_col
private
template<bool External_Load_Access = false, typename Size_Type = std::size_t>
size_type __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::m_num_col
private
template<bool External_Load_Access = false, typename Size_Type = std::size_t>
bool __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::m_resize_needed
private
template<bool External_Load_Access = false, typename Size_Type = std::size_t>
size_type __gnu_pbds::cc_hash_max_collision_check_resize_trigger< External_Load_Access, Size_Type >::m_size
private

The documentation for this class was generated from the following file: