pbr-cpp-memory-pool 1.1.2
Fixed-block-size O(1) memory pool — C++17 with an ANSI C public surface
Loading...
Searching...
No Matches
pool_allocator.hpp File Reference

STL-compatible allocator Adapter over Pool — ADR-0018. More...

#include <it/d4np/memorypool/memory_pool.hpp>
#include <cstddef>
#include <limits>
#include <new>
#include <type_traits>

Go to the source code of this file.

Classes

class  it::d4np::memorypool::PoolAllocator< T >
 STL-compatible allocator vending storage from a Pool. More...
 

Detailed Description

STL-compatible allocator Adapter over Pool — ADR-0018.

PoolAllocator<T> satisfies the Cpp17Allocator requirements so that standard containers can draw their storage from a Pool (ADR-0010). It is the structural Adapter pattern: it bridges the pool's fixed-block void* interface to the variable-size std::allocator_traits contract every container expects.

The adapter is a non-owning back-reference to a Pool (single Pool* member, sizeof == sizeof(void*)): the pool is owned elsewhere and must out-live every container and every adapter copy that references it — the same lifetime contract std::pmr::polymorphic_allocator places on its memory_resource.

Header-only by necessity (class template); adds zero object code to the static library and zero per-pool metadata (ADR-0015 unaffected).

Definition in file pool_allocator.hpp.