# `counter_update_policy` Interface

A list-update policy that moves elements to the front of the list based on the counter algorithm.

This class is likely to slightly change interface when random number generators become part of the C++ standard.

1. `counter_update_policy.hpp`
2. Template parameters.
3. Public Types and Constants:
   1. Size definitions.
4. Public Methods:
   1. Constructors, destructor, and related.
   2. Information methods.
5. Protected Types and Constants:
   1. Metadata definitions.
6. Protected Methods:
   1. Metadata operations.

## Template parameters.

Parameter | Description | Default Value
    Size_Type
| Size type. | size_t
    Metadata_Reference
| Metadata reference type. |
    std::allocator<
      counter_update_metadata>::
        reference

## Size definitions.

Type | Definition | Description
    size_type
    Size_Type
| Size type used for counting the number of times each node is accessed until the count is reset to 0 and the node moved to the front of the list.

## Constructors, destructor, and related.

Method | Description
      counter_update_policy
      (size_type max_count = 5)
| Constructor. `max_count` determines the the number of times each node is accessed until the count is reset to 0 and the node moved to the front of the list.
    void
      swap
      (counter_update_policy &r_other)
| Swaps content.

## Information methods.

Method | Description
    inline
      size_type
      get_max_count
      () const
| Returns the max count of each metadata (number of times it is accessed until moved to the front of the list).

## Metadata definitions.

Type | Definition | Description
    metadata_type
    counter_update_metadata
| Metadata on which this functor operates.
    metadata_reference
    Metadata_Reference
| Reference to metadata on which this functor operates.

## Metadata operations.

Method | Description
    metadata_type
      operator()
      () const
| Creates a metadata object.
    bool
      operator()
      (metadata_reference r_data) const
| Decides whether a metadata object should be moved to the front of the list.