MySQL 9.1.0
Source Code Documentation
|
Heap wrapper that destroys the heap instance when it goes out of scope. More...
#include <mem0mem.h>
Classes | |
struct | mem_heap_free_functor |
A functor with no state to be used for mem_heap destruction. More... | |
Public Types | |
using | Type = mem_heap_t |
Public Member Functions | |
Scoped_heap () | |
Default constructor. More... | |
Scoped_heap (size_t n, ut::Location location) noexcept | |
Constructs heap with a free space of specified size. More... | |
~Scoped_heap ()=default | |
Destructor. More... | |
void | create (size_t n, ut::Location location) noexcept |
Create the heap, it must not already be created. More... | |
bool | is_null () const noexcept |
Check if the memory heap has been created. More... | |
Type * | get () noexcept |
void | reset (Type *p) |
Set the pointer to p. More... | |
void | clear () noexcept |
Empty the heap. More... | |
void * | alloc (size_t n_bytes) noexcept |
Allocate memory in the heap. More... | |
Private Types | |
using | Ptr = std::unique_ptr< Type, mem_heap_free_functor > |
Private Member Functions | |
Scoped_heap (Scoped_heap &&)=delete | |
Scoped_heap (const Scoped_heap &)=delete | |
Scoped_heap & | operator= (Scoped_heap &&)=delete |
Scoped_heap & | operator= (const Scoped_heap &)=delete |
Private Attributes | |
Ptr | m_ptr {} |
Heap to use. More... | |
Heap wrapper that destroys the heap instance when it goes out of scope.
|
private |
using Scoped_heap::Type = mem_heap_t |
|
inline |
Default constructor.
|
inlinenoexcept |
Constructs heap with a free space of specified size.
[in] | n | Initial size of the heap to allocate. |
[in] | location | Location from where called. |
|
default |
Destructor.
|
privatedelete |
|
privatedelete |
|
inlinenoexcept |
Allocate memory in the heap.
[in] | n_bytes | Number of bytes to allocate. |
|
inlinenoexcept |
Empty the heap.
|
inlinenoexcept |
Create the heap, it must not already be created.
[in] | n | Initial size of the heap to allocate. |
[in] | location | Location from where called. |
|
inlinenoexcept |
|
inlinenoexcept |
Check if the memory heap has been created.
|
privatedelete |
|
privatedelete |
|
inline |
Set the pointer to p.
[in] | p | New pointer value. |
|
private |
Heap to use.