MySQL 9.4.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
sql_array.h File Reference
#include <assert.h>
#include <array>
#include <span>
#include "my_alloc.h"

Go to the source code of this file.

Classes

class  Bounds_checked_array< Element_type >
 A wrapper class which provides array bounds checking. More...
 

Functions

template<typename Element_type >
Bounds_checked_array< Element_type > make_array (Element_type *p, size_t n)
 
template<class T >
std::span< TAllocSpan (MEM_ROOT *mem_root, size_t size)
 An equivalent to Bounds_checked_array::Alloc(). More...
 

Function Documentation

◆ AllocSpan()

template<class T >
std::span< T > AllocSpan ( MEM_ROOT mem_root,
size_t  size 
)

An equivalent to Bounds_checked_array::Alloc().

Allocate an array of 'size' elements on 'mem_root', and return that. Note that the resulting span<T> will have data()==nullptr and size()==0 if either the 'size' parameter is 0, or the allocation fails. So data()==nullptr <=> size()==0 is an invariant.

◆ make_array()

template<typename Element_type >
Bounds_checked_array< Element_type > make_array ( Element_type *  p,
size_t  n 
)