libstdc++: Polymorphic memory resources

libstdc++

Polymorphic memory resources
Utilities » Memory
Collaboration diagram for Polymorphic memory resources:

## Files
file | memory_resource

## Classes
struct | std::allocator_traits< pmr::polymorphic_allocator< _Tp > >
class | std::pmr::memory_resource
class | std::pmr::monotonic_buffer_resource
class | std::pmr::polymorphic_allocator< _Tp >
struct | std::pmr::pool_options
class | std::pmr::unsynchronized_pool_resource

## Functions
memory_resource * | std::pmr::new_delete_resource () noexcept

## Detailed Description

Since
  C++17

Memory resources are classes that implement the std::pmr::memory_resource interface for allocating and deallocating memory. Unlike traditional C++ allocators, memory resources are not value types and are used via pointers to the abstract base class. They are only responsible for allocating and deallocating, not for construction and destruction of objects. As a result, memory resources just allocate raw memory as type void* and are not templates that allocate/deallocate and construct/destroy a specific type.

The class template std::pmr::polymorphic_allocator is an allocator that uses a memory resource for its allocations.

## Function Documentation

## ◆ new_delete_resource()

memory_resource * std::pmr::new_delete_resource | ( |  | ) |
| nodiscardnoexcept

A pmr::memory_resource that uses new to allocate memory.

Since
  C++17