29#ifndef MYSQL_ALLOCATORS_ALLOCATOR_H
30#define MYSQL_ALLOCATORS_ALLOCATOR_H
86 if (
p ==
nullptr)
throw std::bad_alloc();
Allocator using a Memory_resource to do the allocator.
Definition: allocator.h:54
constexpr void deallocate(T *p, size_type size)
Use the Memory_resource to deallocate the given pointer.
Definition: allocator.h:95
T value_type
Definition: allocator.h:56
std::function< void(T *)> get_deleter()
Return a Deleter function for objects allocated by this class.
Definition: allocator.h:112
std::ptrdiff_t difference_type
Definition: allocator.h:58
Memory_resource get_memory_resource() const
Return the underlying Memory_resource object.
Definition: allocator.h:123
std::size_t size_type
Definition: allocator.h:57
Allocator(Memory_resource memory_resource=Memory_resource())
Construct a new Allocator using the given Memory_resource.
Definition: allocator.h:65
constexpr T * allocate(size_type n)
Use the Memory_resource to allocate the given number of elements of type T.
Definition: allocator.h:84
const Memory_resource m_memory_resource
The underlying Memory_resource object.
Definition: allocator.h:127
Allocator(const Allocator< U > &other)
Implicit conversion from other instance.
Definition: allocator.h:73
Polymorphism-free memory resource class with custom allocator and deallocator functions.
Definition: memory_resource.h:88
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
const char * p
Definition: ctype-mb.cc:1225
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
size_t size(const char *const c)
Definition: base64.h:46
Definition: gcs_xcom_synode.h:64
int n
Definition: xcom_base.cc:509