MySQL 9.1.0
Source Code Documentation
|
Ownership-agnostic array class, which is both trivial and standard-layout. More...
#include <array_view.h>
Public Types | |
using | Element_t = Element_tp |
Public Member Functions | |
Array_view ()=default | |
Array_view (Element_t *array, std::size_t size) | |
Construct a view over the given array. More... | |
void | assign (Element_t *array, std::size_t size) |
void | allocate (std::size_t size, PSI_memory_key key) |
Create a new array of the given type, replacing the existing one without deallocating it. More... | |
void | free () |
Free the array, assuming it was previously allocated using allocate (or my_malloc ). More... | |
void | clear () |
Public Member Functions inherited from mysql::abi_helpers::detail::Array_base< Element_tp, Element_tp * > | |
std::size_t | size () const |
std::ptrdiff_t | ssize () const |
bool | empty () const |
operator bool () const | |
Element_tp & | operator[] (std::size_t index) |
Index operator (non-const). More... | |
const Element_tp & | operator[] (std::size_t index) const |
Index operator (const). More... | |
Element_tp * | data () |
const Element_tp * | data () const |
Element_tp * | begin () |
const Element_tp * | begin () const |
Element_tp * | end () |
const Element_tp * | end () const |
const Element_tp * | cbegin () const |
const Element_tp * | cend () const |
Private Types | |
using | Self_t = Array_view< Element_tp > |
using | Base_t = detail::Array_base< Element_tp, Element_tp * > |
Additional Inherited Members | |
Protected Attributes inherited from mysql::abi_helpers::detail::Array_base< Element_tp, Element_tp * > | |
int32_t | m_size |
Number of elements in the array. More... | |
Element_tp * | m_data |
Array data. More... | |
Ownership-agnostic array class, which is both trivial and standard-layout.
This holds a length and a raw pointer to an array. The user has to manage ownership of the memory as needed.
Element_tp | The type of elements in the array. |
|
private |
using mysql::abi_helpers::Array_view< Element_tp >::Element_t = Element_tp |
|
private |
|
default |
|
inline |
Construct a view over the given array.
|
inline |
Create a new array of the given type, replacing the existing one without deallocating it.
free
below, are only enabled in the MySQL server. This ensures that a component does not try to free memory allocated by the server or vice versa, which is disallowed on some platforms.size | The number of elements. |
key | The instrumentation key to track the allocation. |
|
inline |
|
inline |
|
inline |
Free the array, assuming it was previously allocated using allocate
(or my_malloc
).
This, and allocate
above, are only enabled in the MySQL server. See above for justification.