1#ifndef SQL_ARRAY_INCLUDED
2#define SQL_ARRAY_INCLUDED
46template <
typename Element_type>
58 template <
class T,
size_t N>
76 if (
data() ==
nullptr) {
80 if (duplicate.
m_array !=
nullptr) {
103 assert(new_size <=
m_size);
112 assert(new_size <=
m_size);
179template <
typename Element_type>
A wrapper class which provides array bounds checking.
Definition: sql_array.h:47
Element_type * data()
Definition: sql_array.h:116
const Element_type * data() const
Definition: sql_array.h:118
Bounds_checked_array(std::array< T, N > &arr)
Definition: sql_array.h:59
Element_type & operator[](size_t n)
Definition: sql_array.h:120
Element_type value_type
Definition: sql_array.h:50
Element_type * m_array
Definition: sql_array.h:175
bool operator!=(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:170
static Bounds_checked_array Alloc(MEM_ROOT *mem_root, size_t size)
Definition: sql_array.h:70
bool is_null() const
Definition: sql_array.h:157
Element_type * array() const
Definition: sql_array.h:165
void resize(size_t new_size)
Set a new bound on the array.
Definition: sql_array.h:102
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:134
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:136
Bounds_checked_array(Element_type *el, size_t size_arg)
Definition: sql_array.h:54
const_iterator end() const
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:141
const_iterator cbegin() const
Returns a pointer to the first element in the array.
Definition: sql_array.h:144
size_t size() const
Definition: sql_array.h:154
size_t element_size() const
Definition: sql_array.h:153
const Element_type & operator[](size_t n) const
Definition: sql_array.h:125
void pop_front()
Definition: sql_array.h:159
const_iterator begin() const
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:139
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:75
Bounds_checked_array()
Definition: sql_array.h:52
Bounds_checked_array without_back() const
Definition: sql_array.h:148
void reset()
Definition: sql_array.h:87
bool empty() const
Definition: sql_array.h:155
const Element_type * const_iterator
Definition: sql_array.h:131
Element_type * iterator
Definition: sql_array.h:130
size_t m_size
Definition: sql_array.h:176
void reset(Element_type *array, size_t size)
Definition: sql_array.h:92
bool operator==(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:167
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:111
const_iterator cend() const
Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:146
static MEM_ROOT mem_root
Definition: client_plugin.cc:110
const char * p
Definition: ctype-mb.cc:1237
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:222
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:180
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
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:180
int n
Definition: xcom_base.cc:509