# `hash_standard_resize_policy` Interface

A resize policy which delegates operations to size and trigger policies.

1. `hash_policy.hpp`
2. Template parameters.
3. Base classes.
4. Public Types and Constants:
   1. General definitions.
   2. Policy definitions.
5. Public Methods:
   1. Constructors, destructor, and related.
   2. Policy access methods.
   3. Size access methods.
6. Protected Methods:
   1. Insert search notifications.
   2. Find search notifications.
   3. Erase search notifications.
   4. Content change notifications.
   5. Size change notifications.
   6. Queries.

## Template parameters.

Parameter | Description | Default Value

    Size_Policy

Size policy type.

`hash_exponential_size_policy<>`

    Trigger_Policy

Trigger policy type.

`ht_load_check_trigger<>`

    External_Size_Access

Indicates whether physical sizes can be accessed externally.

`false`

    Size_Type

Size type.

size_t

## Base classes.

Class | Derivation Type

    Size_Policy

public

    Trigger_Policy

public

## General definitions.

Type | Definition | Description

    size_type

    Size_Type

Size type.

## Policy definitions.

Type | Definition | Description

    trigger_policy

    Trigger_Policy

Trigger policy type.

    size_policy

    Size_Policy

Size policy type.

    external_size_access

    External_Size_Access

Indicates whether sizes can be accessed externally.

## Constructors, destructor, and related.

Method | Description

      hash_standard_resize_policy
      (size_type suggested_size = 8)

Default constructor, or constructor taking `suggested_size`, a suggested size (the actual size will be determined by the `Size_Policy` object).

      hash_standard_resize_policy
      (const Size_Policy &r_size_policy,
        size_type suggested_size = 8)

constructor taking some policies and `suggested_size`, a suggested size (the actual size will be determined by the `Size_Policy` object). `r_size_policy` will be copied by the `Size_Policy` object of this object.

      hash_standard_resize_policy
      (const Size_Policy &r_size_policy,
        const Trigger_Policy &r_trigger_policy,
        size_type suggested_size = 8)

constructor taking some policies and `suggested_size`, a suggested size (the actual size will be determined by the `Size_Policy` object). `r_size_policy` will be copied by the `Size_Policy` object of this object. `r_trigger_policy` will be copied by the `Trigger_Policy` object of this object.

    virtual
      ~hash_standard_resize_policy
      ()

Destructor.

    inline void
      swap
      (hash_standard_resize_policy &r_other)

Swaps content.

## Policy access methods.

Method | Description

    Size_Policy &
      get_size_policy
      ()

Access to the `Size_Policy` object used.

    const Size_Policy &
      get_size_policy
      () const

Const access to the `Size_Policy` object used.

    Trigger_Policy &
      get_trigger_policy
      ()

Access to the `Trigger_Policy` object used.

    const Trigger_Policy &
      get_trigger_policy
      () const

Access to the `Trigger_Policy` object used.

## Size access methods.

These methods are available only if the external size parameter indicates that external size access is allowed.

Method | Description

    inline size_type
      get_actual_size
      () const

Returns the actual size of the container.

This method returns the number of entries (used and unused) in the container. It is different from the container's size method, which returns the number of used entries. Calling this method will not compile when `External_Size_Access` == `false`.

    void
      resize
      (size_type suggested_new_size)

Resizes the container to `suggested_new_size`, a suggested size (the actual size will be determined by the `Size_Policy` object).

Calling this method will not compile when `External_Size_Access` == `false`.

## Insert search notifications.

Notifications called during an insert operation.

Method | Description

    inline void
      notify_insert_search_start
      ()

Notifies a search started.

    inline void
      notify_insert_search_collision
      ()

Notifies a search encountered a collision.

    inline void
      notify_insert_search_end
      ()

Notifies a search ended.

## Find search notifications.

Notifications called during a find operation.

Method | Description

    inline void
      notify_find_search_start
      ()

Notifies a search started.

    inline void
      notify_find_search_collision
      ()

Notifies a search encountered a collision.

    inline void
      notify_find_search_end
      ()

Notifies a search ended.

## Erase search notifications.

Notifications called during an insert operation.

Method | Description

    inline void
      notify_erase_search_start
      ()

Notifies a search started.

    inline void
      notify_erase_search_collision
      ()

Notifies a search encountered a collision.

    inline void
      notify_erase_search_end
      ()

Notifies a search ended.

## Content change notifications.

Notifications called when the content of the table changes in a way that can affect the resize policy.

Method | Description

    inline void
      notify_inserted
      (size_type num_e)

Notifies an element was inserted.

    inline void
      notify_erased
      (size_type num_e)

Notifies an element was erased.

    void
      notify_cleared
      ()

Notifies the table was cleared.

## Size change notifications.

Notifications called when the table changes size.

Method | Description

    void
      notify_resized
      (size_type new_size)

Notifies the table was resized to `new_size`.

## Queries.

Called to query whether/how to resize.

Method | Description

    size_type
      get_init_size
      () const

Queries initial size.

    inline bool
      is_resize_needed
      () const

Queries whether a resize is needed.

    size_type
      get_new_size
      (size_type size, size_type num_used_e) const

Queries what the new `size` should be.