---
name: "__gnu_cxx::__mt_alloc"
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_cxx::__mt_alloc/3cxx"
---

# \_\_gnu\_cxx::\_\_mt\_alloc(3cxx)

This is a fixed size (power of 2) allocator which - when compiled with thread support - will maintain one freelist per size per thread plus a global one. Steps are taken to limit the per thread freelist sizes (by returning excess back to the global list).

## NAME

\_\_gnu\_cxx::\_\_mt\_alloc\< \_Tp, \_Poolp \> - This is a fixed size (power of 2) allocator which - when compiled with thread support - will maintain one freelist per size per thread plus a *global* one. Steps are taken to limit the per thread freelist sizes (by returning excess back to the *global* list).

## SYNOPSIS

`#include <mt_allocator.h>`

Inherits **\_\_gnu\_cxx::\_\_mt\_alloc\_base\< \_Tp \>**.

### Public Types

typedef \_Poolp **\_\_policy\_type**\
 typedef \_Poolp::pool\_type **\_\_pool\_type**\
 typedef const \_Tp \* **const\_pointer**\
 typedef const \_Tp & **const\_reference**\
 typedef std::ptrdiff\_t **difference\_type**\
 typedef \_Tp \* **pointer**\
 typedef **std::true\_type** **propagate\_on\_container\_move\_assignment**\
 typedef \_Tp & **reference**\
 typedef std::size\_t **size\_type**\
 typedef \_Tp **value\_type**\

### Public Member Functions

**\_\_mt\_alloc** (const **\_\_mt\_alloc** &) noexcept\
 template\<typename \_Tp1 , typename \_Poolp1 \> **\_\_mt\_alloc** (const **\_\_mt\_alloc**\< \_Tp1, \_Poolp1 \> &) noexcept\
 const \_\_pool\_base::\_Tune **\_M\_get\_options** ()\
 void **\_M\_set\_options** (\_\_pool\_base::\_Tune \_\_t)\
 const\_pointer **address** (const\_reference \_\_x) const noexcept\
 pointer **address** (reference \_\_x) const noexcept\
 pointer **allocate** (size\_type \_\_n, const void \*=0)\
 template\<typename \_Up , typename... \_Args\> void **construct** (\_Up \*\_\_p, \_Args &&... \_\_args)\
 void **deallocate** (pointer \_\_p, size\_type \_\_n)\
 template\<typename \_Up \> void **destroy** (\_Up \*\_\_p)\
 size\_type **max\_size** () const noexcept\

## Detailed Description

### template\<typename \_Tp, typename \_Poolp = \_\_common\_pool\_policy\<\_\_pool, true \>\>

class \_\_gnu\_cxx::\_\_mt\_alloc\< \_Tp, \_Poolp \>"This is a fixed size (power of 2) allocator which - when compiled with thread support - will maintain one freelist per size per thread plus a *global* one. Steps are taken to limit the per thread freelist sizes (by returning excess back to the *global* list).

Further details: https://gcc.gnu.org/onlinedocs/libstdc++/manual/mt\_allocator.html

## Author

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