---
name: "__gnu_pbds::lu_counter_policy"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_pbds::lu_counter_policy"
---

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

## NAME

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

## SYNOPSIS

\#include \<list\_update\_policy.hpp\>

Inherits **\_\_gnu\_pbds::detail::lu\_counter\_policy\_base\< 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

template\<typename Metadata\_Reference\> 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 **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 **max\_count**.

## Author

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