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

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

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\< value\_type \>**, **\_\_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\
 \_Tp \* **allocate** (size\_type \_\_n, const **void** \*=**static\_cast**\< const **void** \* \>(0))\
 **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.
