24#ifndef MEM_ROOT_ALLOCATOR_INCLUDED
25#define MEM_ROOT_ALLOCATOR_INCLUDED
101 if (
n == 0)
return nullptr;
102 if (
n >
max_size())
throw std::bad_alloc();
105 if (
p ==
nullptr)
throw std::bad_alloc();
111 template <
class U,
class... Args>
113 assert(
p !=
nullptr);
115 ::new ((
void *)
p)
U(std::forward<Args>(args)...);
122 assert(
p !=
nullptr);
131 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:68
const T * const_pointer
Definition: mem_root_allocator.h:78
MEM_ROOT * m_memroot
Definition: mem_root_allocator.h:70
Mem_root_allocator()
Definition: mem_root_allocator.h:88
Mem_root_allocator(MEM_ROOT *memroot)
Definition: mem_root_allocator.h:86
pointer allocate(size_type n, const_pointer hint=nullptr)
Definition: mem_root_allocator.h:100
size_t size_type
Definition: mem_root_allocator.h:74
pointer address(reference r) const
Definition: mem_root_allocator.h:83
const_pointer address(const_reference r) const
Definition: mem_root_allocator.h:84
T & reference
Definition: mem_root_allocator.h:80
size_type max_size() const
Definition: mem_root_allocator.h:130
Mem_root_allocator & operator=(const Mem_root_allocator< U > &other)
Definition: mem_root_allocator.h:95
void construct(U *p, Args &&...args)
Definition: mem_root_allocator.h:112
Mem_root_allocator(const Mem_root_allocator< U > &other)
Definition: mem_root_allocator.h:91
ptrdiff_t difference_type
Definition: mem_root_allocator.h:75
T value_type
Definition: mem_root_allocator.h:73
const T & const_reference
Definition: mem_root_allocator.h:81
void deallocate(pointer, size_type)
Definition: mem_root_allocator.h:109
void destroy(pointer p)
Definition: mem_root_allocator.h:121
T * pointer
Definition: mem_root_allocator.h:77
MEM_ROOT * memroot() const
Definition: mem_root_allocator.h:139
const char * p
Definition: ctype-mb.cc:1237
#define U
Definition: ctype-tis620.cc:75
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
bool operator==(const Mem_root_allocator< T > &a1, const Mem_root_allocator< T > &a2)
Definition: mem_root_allocator.h:143
bool operator!=(const Mem_root_allocator< T > &a1, const Mem_root_allocator< T > &a2)
Definition: mem_root_allocator.h:149
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:86
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:145
Definition: mem_root_allocator.h:135
Mem_root_allocator< U > other
Definition: mem_root_allocator.h:136
int n
Definition: xcom_base.cc:509