23#ifndef MEM_ROOT_ALLOCATOR_INCLUDED
24#define MEM_ROOT_ALLOCATOR_INCLUDED
100 if (
n == 0)
return nullptr;
101 if (
n >
max_size())
throw std::bad_alloc();
104 if (
p ==
nullptr)
throw std::bad_alloc();
110 template <
class U,
class... Args>
112 assert(
p !=
nullptr);
114 ::new ((
void *)
p)
U(std::forward<Args>(args)...);
121 assert(
p !=
nullptr);
130 return std::numeric_limits<size_t>::max() /
sizeof(T);
Mem_root_allocator is a C++ STL memory allocator based on MEM_ROOT.
Definition: mem_root_allocator.h:67
const T * const_pointer
Definition: mem_root_allocator.h:77
MEM_ROOT * m_memroot
Definition: mem_root_allocator.h:69
Mem_root_allocator()
Definition: mem_root_allocator.h:87
Mem_root_allocator(MEM_ROOT *memroot)
Definition: mem_root_allocator.h:85
pointer allocate(size_type n, const_pointer hint=nullptr)
Definition: mem_root_allocator.h:99
size_t size_type
Definition: mem_root_allocator.h:73
pointer address(reference r) const
Definition: mem_root_allocator.h:82
const_pointer address(const_reference r) const
Definition: mem_root_allocator.h:83
T & reference
Definition: mem_root_allocator.h:79
size_type max_size() const
Definition: mem_root_allocator.h:129
Mem_root_allocator & operator=(const Mem_root_allocator< U > &other)
Definition: mem_root_allocator.h:94
Mem_root_allocator(const Mem_root_allocator< U > &other)
Definition: mem_root_allocator.h:90
ptrdiff_t difference_type
Definition: mem_root_allocator.h:74
T value_type
Definition: mem_root_allocator.h:72
const T & const_reference
Definition: mem_root_allocator.h:80
void deallocate(pointer, size_type)
Definition: mem_root_allocator.h:108
void destroy(pointer p)
Definition: mem_root_allocator.h:120
void construct(U *p, Args &&... args)
Definition: mem_root_allocator.h:111
T * pointer
Definition: mem_root_allocator.h:76
MEM_ROOT * memroot() const
Definition: mem_root_allocator.h:138
const char * p
Definition: ctype-mb.cc:1234
#define U
Definition: ctype-tis620.cc:73
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
bool operator==(const Mem_root_allocator< T > &a1, const Mem_root_allocator< T > &a2)
Definition: mem_root_allocator.h:142
bool operator!=(const Mem_root_allocator< T > &a1, const Mem_root_allocator< T > &a2)
Definition: mem_root_allocator.h:148
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
const mysql_service_registry_t * r
Definition: pfs_example_plugin_employee.cc:85
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:144
Definition: mem_root_allocator.h:134
Mem_root_allocator< U > other
Definition: mem_root_allocator.h:135
int n
Definition: xcom_base.cc:508