28#ifndef MYSQL_ALLOCATORS_MEMORY_RESOURCE_H
29#define MYSQL_ALLOCATORS_MEMORY_RESOURCE_H
Polymorphism-free memory resource class with custom allocator and deallocator functions.
Definition: memory_resource.h:88
void * Ptr_t
Definition: memory_resource.h:91
const Allocator_t m_allocator
The allocator object.
Definition: memory_resource.h:125
void * allocate(Size_t n) const
Allocate memory using the provided allocator.
Definition: memory_resource.h:113
void deallocate(Ptr_t p) const
Deallocate memory using the provided deallocator.
Definition: memory_resource.h:118
Deallocator_t get_deallocator() const
Return the deallocator.
Definition: memory_resource.h:121
std::function< void(Ptr_t)> Deallocator_t
Definition: memory_resource.h:93
Memory_resource(const Allocator_t &allocator, const Deallocator_t &deallocator)
Construct a new Memory_resource that uses the given allocator and deallocator.
Definition: memory_resource.h:101
Memory_resource()
Construct a new Memory_resource that uses std::malloc and std::free.
Definition: memory_resource.h:106
std::function< Ptr_t(Size_t)> Allocator_t
Definition: memory_resource.h:92
const Deallocator_t m_deallocator
The deallocator object.
Definition: memory_resource.h:128
std::size_t Size_t
Definition: memory_resource.h:90
const char * p
Definition: ctype-mb.cc:1225
#define malloc(A)
Definition: lexyy.cc:914
#define free(A)
Definition: lexyy.cc:915
Definition: allocator.h:40
Definition: gcs_xcom_synode.h:64
int n
Definition: xcom_base.cc:509