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

# std::allocator(3cxx)

The standard allocator, as per C++03 \[20.4.1\].

## NAME

std::allocator\< \_Tp \> - The *standard* allocator, as per C++03 \[20.4.1\].

## SYNOPSIS

`#include <memory>`

Inherits **std::\_\_new\_allocator\< \_Tp \>**.

### Public Types

**typedef** ptrdiff\_t **difference\_type**\
 **using** **is\_always\_equal** = **true\_type**\
 **using** **propagate\_on\_container\_move\_assignment** = **true\_type**\
 **typedef** size\_t **size\_type**\
 **typedef** \_Tp **value\_type**\

### Public Member Functions

constexpr **allocator** (const **allocator** &\_\_a) noexcept\
 template\<**typename** **\_Tp1** \> constexpr **allocator** (const **allocator**\< **\_Tp1** \> &) noexcept\
 constexpr \_Tp \* **allocate** (size\_t \_\_n)\
 \_Tp \* **allocate** (size\_type \_\_n, const **void** \*=**static\_cast**\< const **void** \* \>(0))\
 constexpr **void** **deallocate** (\_Tp \*\_\_p, size\_t \_\_n)\
 **allocator** & **operator=** (const **allocator** &)=**default**\

### Friends

constexpr bool **operator==** (const **allocator** &, const **allocator** &) noexcept\

### Related Symbols

(Note that these are not member symbols.)  template\<**typename** \_T1 , **typename** \_T2 \> constexpr bool **operator==** (const **allocator**\< \_T1 \> &, const **allocator**\< \_T2 \> &) noexcept\

## Detailed Description

### template\<typename \_Tp\>

class std::allocator\< \_Tp \>"The *standard* allocator, as per C++03 \[20.4.1\].

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/memory.html#std.util.memory.allocator for further details.

**Template Parameters**

*\_Tp* Type of allocated object.

## Author

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