MySQL 8.4.2
Source Code Documentation
mem_heap_allocator< T > Class Template Reference

A C++ wrapper class to the mem_heap_t routines, so that it can be used as an STL allocator. More...

#include <mem0mem.h>

Classes

struct  rebind
 Allocators are required to supply the below template class member which enables the possibility of obtaining a related allocator, parametrized in terms of a different type. More...
 

Public Types

typedef T value_type
 
typedef size_t size_type
 
typedef ptrdiff_t difference_type
 
typedef T * pointer
 
typedef const T * const_pointer
 
typedef T & reference
 
typedef const T & const_reference
 

Public Member Functions

 mem_heap_allocator (mem_heap_t *heap)
 
 mem_heap_allocator (const mem_heap_allocator &other)
 
template<typename U >
 mem_heap_allocator (const mem_heap_allocator< U > &other)
 
 ~mem_heap_allocator ()
 
size_type max_size () const
 
pointer allocate (size_type n, const_pointer hint=nullptr)
 This function returns a pointer to the first element of a newly allocated array large enough to contain n objects of type T; only the memory is allocated, and the objects are not constructed. More...
 
void deallocate (pointer, size_type)
 
pointer address (reference r) const
 
const_pointer address (const_reference r) const
 
void construct (pointer p, const_reference t)
 
void destroy (pointer p)
 
mem_heap_tget_mem_heap () const
 Get the underlying memory heap object. More...
 

Private Attributes

mem_heap_tm_heap
 

Friends

template<typename U >
class mem_heap_allocator
 

Detailed Description

template<typename T>
class mem_heap_allocator< T >

A C++ wrapper class to the mem_heap_t routines, so that it can be used as an STL allocator.

Member Typedef Documentation

◆ const_pointer

template<typename T >
typedef const T* mem_heap_allocator< T >::const_pointer

◆ const_reference

template<typename T >
typedef const T& mem_heap_allocator< T >::const_reference

◆ difference_type

template<typename T >
typedef ptrdiff_t mem_heap_allocator< T >::difference_type

◆ pointer

template<typename T >
typedef T* mem_heap_allocator< T >::pointer

◆ reference

template<typename T >
typedef T& mem_heap_allocator< T >::reference

◆ size_type

template<typename T >
typedef size_t mem_heap_allocator< T >::size_type

◆ value_type

template<typename T >
typedef T mem_heap_allocator< T >::value_type

Constructor & Destructor Documentation

◆ mem_heap_allocator() [1/3]

template<typename T >
mem_heap_allocator< T >::mem_heap_allocator ( mem_heap_t heap)
inline

◆ mem_heap_allocator() [2/3]

template<typename T >
mem_heap_allocator< T >::mem_heap_allocator ( const mem_heap_allocator< T > &  other)
inline

◆ mem_heap_allocator() [3/3]

template<typename T >
template<typename U >
mem_heap_allocator< T >::mem_heap_allocator ( const mem_heap_allocator< U > &  other)
inline

◆ ~mem_heap_allocator()

template<typename T >
mem_heap_allocator< T >::~mem_heap_allocator ( )
inline

Member Function Documentation

◆ address() [1/2]

template<typename T >
const_pointer mem_heap_allocator< T >::address ( const_reference  r) const
inline

◆ address() [2/2]

template<typename T >
pointer mem_heap_allocator< T >::address ( reference  r) const
inline

◆ allocate()

template<typename T >
pointer mem_heap_allocator< T >::allocate ( size_type  n,
const_pointer  hint = nullptr 
)
inline

This function returns a pointer to the first element of a newly allocated array large enough to contain n objects of type T; only the memory is allocated, and the objects are not constructed.

Moreover, an optional pointer argument (that points to an object already allocated by mem_heap_allocator) can be used as a hint to the implementation about where the new memory should be allocated in order to improve locality.

◆ construct()

template<typename T >
void mem_heap_allocator< T >::construct ( pointer  p,
const_reference  t 
)
inline

◆ deallocate()

template<typename T >
void mem_heap_allocator< T >::deallocate ( pointer  ,
size_type   
)
inline

◆ destroy()

template<typename T >
void mem_heap_allocator< T >::destroy ( pointer  p)
inline

◆ get_mem_heap()

template<typename T >
mem_heap_t * mem_heap_allocator< T >::get_mem_heap ( ) const
inline

Get the underlying memory heap object.

Returns
the underlying memory heap object.

◆ max_size()

template<typename T >
size_type mem_heap_allocator< T >::max_size ( ) const
inline

Friends And Related Function Documentation

◆ mem_heap_allocator

template<typename T >
template<typename U >
friend class mem_heap_allocator
friend

Member Data Documentation

◆ m_heap

template<typename T >
mem_heap_t* mem_heap_allocator< T >::m_heap
private

The documentation for this class was generated from the following file: