---
name: "std::__new_allocator"
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/std::__new_allocator"
---

# std::\_\_new\_allocator(3)

An allocator that uses global new, as per C++03 \[20.4.1\].

## NAME

std::\_\_new\_allocator\< \_Tp \> - An allocator that uses global new, as per C++03 \[20.4.1\].

## SYNOPSIS

\#include \<memory\>

Inherited by **std::allocator\< \_Up \>**, **std::allocator\< value\_type \>**, **std::allocator\< void \>**, **std::allocator\< byte \>**, **\_\_gnu\_cxx::new\_allocator\< \_Tp \>**, and **std::allocator\< \_Tp \>**.

### Public Types

typedef std::ptrdiff\_t **difference\_type**\
 typedef **std::true\_type** **propagate\_on\_container\_move\_assignment**\
 typedef std::size\_t **size\_type**\
 typedef \_Tp **value\_type**\

### Public Member Functions

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

### Friends

template\<typename \_Up\> constexpr bool **operator==** (const \_\_new\_allocator &, const \_\_new\_allocator\< \_Up \> &) noexcept\

## Detailed Description

### template\<typename \_Tp\>

class std::\_\_new\_allocator\< \_Tp \>"An allocator that uses global new, as per C++03 \[20.4.1\].

This is precisely the allocator defined in the C++ Standard.

- •

  all allocation calls operator new

- •

  all deallocation calls operator delete

This is the default base-class implementation of std::allocator, and is also the base-class of the \_\_gnu\_cxx::new\_allocator extension. You should use either std::allocator or \_\_gnu\_cxx::new\_allocator instead of using this directly.

**Template Parameters**

*\_Tp* Type of allocated object.

## Author

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