1#ifndef SQL_ARRAY_INCLUDED
2#define SQL_ARRAY_INCLUDED
45template <
typename Element_type>
57 template <
class T,
size_t N>
85 assert(new_size <=
m_size);
94 assert(new_size <=
m_size);
156template <
typename Element_type>
A wrapper class which provides array bounds checking.
Definition: sql_array.h:46
Element_type * data()
Definition: sql_array.h:98
const Element_type * data() const
Definition: sql_array.h:100
Bounds_checked_array(std::array< T, N > &arr)
Definition: sql_array.h:58
Element_type & operator[](size_t n)
Definition: sql_array.h:102
Element_type value_type
Definition: sql_array.h:49
Element_type * m_array
Definition: sql_array.h:152
bool operator!=(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:147
static Bounds_checked_array Alloc(MEM_ROOT *mem_root, size_t size)
Definition: sql_array.h:65
bool is_null() const
Definition: sql_array.h:134
Element_type * array() const
Definition: sql_array.h:142
void resize(size_t new_size)
Set a new bound on the array.
Definition: sql_array.h:84
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:116
iterator end()
end : Returns a pointer to the past-the-end element in the array.
Definition: sql_array.h:118
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:123
size_t size() const
Definition: sql_array.h:131
size_t element_size() const
Definition: sql_array.h:130
const Element_type & operator[](size_t n) const
Definition: sql_array.h:107
void pop_front()
Definition: sql_array.h:136
const_iterator begin() const
begin : Returns a pointer to the first element in the array.
Definition: sql_array.h:121
Bounds_checked_array()
Definition: sql_array.h:51
Bounds_checked_array without_back() const
Definition: sql_array.h:125
void reset()
Definition: sql_array.h:69
bool empty() const
Definition: sql_array.h:132
const Element_type * const_iterator
Definition: sql_array.h:113
Element_type * iterator
Definition: sql_array.h:112
size_t m_size
Definition: sql_array.h:153
void reset(Element_type *array, size_t size)
Definition: sql_array.h:74
bool operator==(const Bounds_checked_array< Element_type > &rhs) const
Definition: sql_array.h:144
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:93
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:157
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:505