1#ifndef SQL_ARRAY_INCLUDED
2#define SQL_ARRAY_INCLUDED
45template <
typename Element_type>
57 template <
class T,
size_t N>
75 if (
data() ==
nullptr) {
79 if (duplicate.
m_array !=
nullptr) {
102 assert(new_size <=
m_size);
111 assert(new_size <=
m_size);
178template <
typename Element_type>
A wrapper class which provides array bounds checking.
Definition: sql_array.h:46
Element_type * data()
Definition: sql_array.h:115
const Element_type * data() const
Definition: sql_array.h:117
Bounds_checked_array(std::array< T, N > &arr)
Definition: sql_array.h:58
Element_type & operator[](size_t n)
Definition: sql_array.h:119
Element_type value_type
Definition: sql_array.h:49
Element_type * m_array
Definition: sql_array.h:174
bool operator!=(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:169
static Bounds_checked_array Alloc(MEM_ROOT *mem_root, size_t size)
Definition: sql_array.h:69
bool is_null() const
Definition: sql_array.h:156
Element_type * array() const
Definition: sql_array.h:164
void resize(size_t new_size)
Set a new bound on the array.
Definition: sql_array.h:101
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:133
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:135
Bounds_checked_array(Element_type *el, size_t size_arg)
Definition: sql_array.h:53
const_iterator end() const
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:140
const_iterator cbegin() const
Returns a pointer to the first element in the array.
Definition: sql_array.h:143
size_t size() const
Definition: sql_array.h:153
size_t element_size() const
Definition: sql_array.h:152
const Element_type & operator[](size_t n) const
Definition: sql_array.h:124
void pop_front()
Definition: sql_array.h:158
const_iterator begin() const
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:138
Bounds_checked_array Clone(MEM_ROOT *mem_root) const
Make a copy of '*this'. Allocate memory for m_array on 'mem_root'.
Definition: sql_array.h:74
Bounds_checked_array()
Definition: sql_array.h:51
Bounds_checked_array without_back() const
Definition: sql_array.h:147
void reset()
Definition: sql_array.h:86
bool empty() const
Definition: sql_array.h:154
const Element_type * const_iterator
Definition: sql_array.h:130
Element_type * iterator
Definition: sql_array.h:129
size_t m_size
Definition: sql_array.h:175
void reset(Element_type *array, size_t size)
Definition: sql_array.h:91
bool operator==(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:166
Bounds_checked_array prefix(size_t new_size)
Like resize(), but returns a new view of the array without modifying this one.
Definition: sql_array.h:110
const_iterator cend() const
Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:145
static MEM_ROOT mem_root
Definition: client_plugin.cc:113
const char * p
Definition: ctype-mb.cc:1234
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Bounds_checked_array< Element_type > make_array(Element_type *p, size_t n)
Definition: sql_array.h:179
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
T * ArrayAlloc(size_t num, Args... args)
Allocate “num” objects of type T, and initialize them to a default value that is created by passing t...
Definition: my_alloc.h:179
int n
Definition: xcom_base.cc:508