Polymorphic allocator library

From cppreference.com

The C++ Extensions for Library Fundamentals includes classes for providing allocator type erasure and runtime polymorphism.

[edit] std::experimental::pmr::memory_resource

The memory_resource class is an abstract interface for classes that encapsulate memory resources.

The library provides the following concrete classes:

Defined in header <experimental/memory_resource>
Class Description


Pool resources are a type of memory_resource for managing allocations in pools of different block sizes. The library provides both a thread-safe and unsafe pool resource.
std::experimental::pmr::monotonic_buffer_resource A special-purpose memory_resource intended for very fast memory allocations in situations where memory is used to build up a few objects and then is released all at once when the buffer is destroyed.

[edit] std::experimental::pmr::polymorphic_allocator

Using a specialization of the class template pmr::polymorphic_allocator with an allocator-aware class allows allocators to be used polymorphically at run time.

[edit] std::experimental::pmr::resource_adaptor

The template alias resource_adaptor wraps a memory_resource interface around an allocator.