32#ifndef MYSQL_RESOURCE_ALLOCATOR_H_
33#define MYSQL_RESOURCE_ALLOCATOR_H_
86 if (
p ==
nullptr)
throw std::bad_alloc();
Allocator using a Memory_resource to do the allocator.
Definition: allocator.h:54
constexpr T * allocate(size_type n)
Use the Memory_resource to allocate the given number of elements of type T.
Definition: allocator.h:84
std::size_t size_type
Definition: allocator.h:57
const Memory_resource m_memory_resource
The underlying Memory_resource object.
Definition: allocator.h:127
std::function< void(T *)> get_deleter()
Return a Deleter function for objects allocated by this class.
Definition: allocator.h:112
Allocator(Memory_resource memory_resource=Memory_resource())
Construct a new Allocator using the given Memory_resource.
Definition: allocator.h:65
std::ptrdiff_t difference_type
Definition: allocator.h:58
Allocator(const Allocator< U > &other)
Implicit conversion from other instance.
Definition: allocator.h:73
constexpr void deallocate(T *p, size_type size)
Use the Memory_resource to deallocate the given pointer.
Definition: allocator.h:95
Memory_resource get_memory_resource() const
Return the underlying Memory_resource object.
Definition: allocator.h:123
T value_type
Definition: allocator.h:56
Polymorphism-free memory resource class with custom allocator and deallocator functions.
Definition: memory_resource.h:88
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
void * allocate(Size_t n) const
Allocate memory using the provided allocator.
Definition: memory_resource.h:113
const char * p
Definition: ctype-mb.cc:1237
Class that wraps resources in a polymorphic manner.
Definition: allocator.h:40
bool operator!=(const Allocator< T > &a1, const Allocator< T > &a2)
Compare two Allocator objects for inequality.
Definition: allocator.h:139
bool operator==(const Allocator< T > &a1, const Allocator< T > &a2)
Compare two Allocator objects for equality.
Definition: allocator.h:132
Definition: gcs_xcom_synode.h:64
int n
Definition: xcom_base.cc:509