1#ifndef SQL_ARRAY_INCLUDED
2#define SQL_ARRAY_INCLUDED
45template <
typename Element_type>
57 template <
class T,
size_t N>
89 assert(new_size <=
m_size);
98 assert(new_size <=
m_size);
160template <
typename Element_type>
A wrapper class which provides array bounds checking.
Definition: sql_array.h:46
Element_type * data()
Definition: sql_array.h:102
const Element_type * data() const
Definition: sql_array.h:104
Bounds_checked_array(std::array< T, N > &arr)
Definition: sql_array.h:58
Element_type & operator[](size_t n)
Definition: sql_array.h:106
Element_type value_type
Definition: sql_array.h:49
Element_type * m_array
Definition: sql_array.h:156
bool operator!=(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:151
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:138
Element_type * array() const
Definition: sql_array.h:146
void resize(size_t new_size)
Set a new bound on the array.
Definition: sql_array.h:88
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:120
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:122
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:127
size_t size() const
Definition: sql_array.h:135
size_t element_size() const
Definition: sql_array.h:134
const Element_type & operator[](size_t n) const
Definition: sql_array.h:111
void pop_front()
Definition: sql_array.h:140
const_iterator begin() const
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:125
Bounds_checked_array()
Definition: sql_array.h:51
Bounds_checked_array without_back() const
Definition: sql_array.h:129
void reset()
Definition: sql_array.h:73
bool empty() const
Definition: sql_array.h:136
const Element_type * const_iterator
Definition: sql_array.h:117
Element_type * iterator
Definition: sql_array.h:116
size_t m_size
Definition: sql_array.h:157
void reset(Element_type *array, size_t size)
Definition: sql_array.h:78
bool operator==(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:148
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:97
static MEM_ROOT mem_root
Definition: client_plugin.cc:109
const char * p
Definition: ctype-mb.cc:1236
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:161
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