---
name: "__gnu_pbds::lu_counter_policy"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_pbds::lu_counter_policy/3cxx"
---

# \_\_gnu\_pbds::lu\_counter\_policy(3cxx)

## NAME

\_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>

## SYNOPSIS

`#include <list_update_policy.hpp>`

Inherits **\_\_gnu\_pbds::detail::lu\_counter\_policy\_base\< \_Alloc::size\_type \>**.

### Public Types

enum { **max\_count** }\
 typedef \_Alloc **allocator\_type**\
 typedef **detail::rebind\_traits**\< \_Alloc, **metadata\_type** \>::reference **metadata\_reference**\
 Reference to metadata on which this functor operates.  typedef **detail::lu\_counter\_metadata**\< size\_type \> **metadata\_type**\
 Metadata on which this functor operates.  typedef allocator\_type::size\_type **size\_type**\

### Public Member Functions

**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.

### Private Member Functions

bool **operator()** (Metadata\_Reference r\_data, size\_type m\_max\_count) const\
 lu\_counter\_metadata\< size\_type \> **operator()** (size\_type max\_size) const\

## Detailed Description

### template\<std::size\_t Max\_Count = 5, typename \_Alloc = std::allocator\<char\>\>

class \_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>"A list-update policy that moves elements to the front of the list based on the counter algorithm.

## Member Typedef Documentation

### template\<std::size\_t Max\_Count = 5, typename \_Alloc = std::allocator\<char\>\> typedef detail::rebind\_traits\<\_Alloc,metadata\_type\>::reference \_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>::metadata\_reference

Reference to metadata on which this functor operates.

### template\<std::size\_t Max\_Count = 5, typename \_Alloc = std::allocator\<char\>\> typedef detail::lu\_counter\_metadata\<size\_type\> \_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>::metadata\_type

Metadata on which this functor operates.

## Member Enumeration Documentation

### template\<std::size\_t Max\_Count = 5, typename \_Alloc = std::allocator\<char\>\> anonymous enum

**Enumerator**

- *max\_count*

  *When some element is accessed this number of times, it will be moved to the front of the list.*

## Member Function Documentation

### template\<std::size\_t Max\_Count = 5, typename \_Alloc = std::allocator\<char\>\> metadata\_type \_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>::operator() () const` [inline]`

*Creates a metadata object.*

*References* **\_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>::max\_count***.*

### template\<std::size\_t Max\_Count = 5, typename \_Alloc = std::allocator\<char\>\> bool \_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>::operator() (metadata\_reference r\_data) const` [inline]`

*Decides whether a metadata object should be moved to the front of the list.*

*References* **\_\_gnu\_pbds::lu\_counter\_policy\< Max\_Count, \_Alloc \>::max\_count***.*

## Author

*Generated automatically by Doxygen for libstdc++ from the source code.*
