MySQL 9.1.0
Source Code Documentation
mysql::abi_helpers::detail::Array_base< Element_t, Array_t > Class Template Reference

Base class for specific implementations of standard-layout classes for arrays. More...

#include <array_base.h>

Public Member Functions

std::size_t size () const
 
std::ptrdiff_t ssize () const
 
bool empty () const
 
 operator bool () const
 
Element_t & operator[] (std::size_t index)
 Index operator (non-const). More...
 
Element_t * data ()
 
Element_t * begin ()
 
Element_t * end ()
 
const Element_t & operator[] (std::size_t index) const
 Index operator (const). More...
 
const Element_t * data () const
 
const Element_t * begin () const
 
const Element_t * end () const
 
const Element_t * cbegin () const
 
const Element_t * cend () const
 

Protected Attributes

int32_t m_size
 Number of elements in the array. More...
 
Array_t m_data
 Array data. More...
 

Detailed Description

template<class Element_t, class Array_t>
requires requires
class mysql::abi_helpers::detail::Array_base< Element_t, Array_t >

Base class for specific implementations of standard-layout classes for arrays.

This stores the length and the array, and exposes iterators, index operators and member functions to query size/emptiness.

Template Parameters
Element_tThe type of each element.
Array_tThe type of the array, for example Element_t * or Element_t[7].

Member Function Documentation

◆ begin() [1/2]

template<class Element_t , class Array_t >
Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::begin ( )
inline
Returns
Iterator to the beginning (non-const).

Actually, just the raw pointer. This is a contiguous iterator.

◆ begin() [2/2]

template<class Element_t , class Array_t >
const Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::begin ( ) const
inline
Returns
Iterator to the beginning (const).

◆ cbegin()

template<class Element_t , class Array_t >
const Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::cbegin ( ) const
inline
Returns
Iterator to the beginning (const).

◆ cend()

template<class Element_t , class Array_t >
const Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::cend ( ) const
inline
Returns
Iterator to the end (const).

◆ data() [1/2]

template<class Element_t , class Array_t >
Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::data ( )
inline
Returns
Pointer to the array (non-const, equal to begin()).

◆ data() [2/2]

template<class Element_t , class Array_t >
const Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::data ( ) const
inline
Returns
Pointer to the array (const, equal to cbegin()).

◆ empty()

template<class Element_t , class Array_t >
bool mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::empty ( ) const
inline
Returns
true if there are no elements, false if there are any.

◆ end() [1/2]

template<class Element_t , class Array_t >
Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::end ( )
inline
Returns
Iterator to the end (non-const).

Actually, just the raw pointer. This is a contiguous iterator.

◆ end() [2/2]

template<class Element_t , class Array_t >
const Element_t * mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::end ( ) const
inline
Returns
Iterator to the end (const).

◆ operator bool()

template<class Element_t , class Array_t >
mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::operator bool ( ) const
inline
Returns
true if there are any elements, false if there are none.

◆ operator[]() [1/2]

template<class Element_t , class Array_t >
Element_t & mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::operator[] ( std::size_t  index)
inline

Index operator (non-const).

Parameters
indexArray index.
Returns
Non-const reference to element at the given index.

◆ operator[]() [2/2]

template<class Element_t , class Array_t >
const Element_t & mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::operator[] ( std::size_t  index) const
inline

Index operator (const).

Parameters
indexArray index.
Returns
Const reference to element at the given index.

◆ size()

template<class Element_t , class Array_t >
std::size_t mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::size ( ) const
inline
Returns
Number of elements.

◆ ssize()

template<class Element_t , class Array_t >
std::ptrdiff_t mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::ssize ( ) const
inline
Returns
Number of elements (signed).

Member Data Documentation

◆ m_data

template<class Element_t , class Array_t >
Array_t mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::m_data
protected

Array data.

◆ m_size

template<class Element_t , class Array_t >
int32_t mysql::abi_helpers::detail::Array_base< Element_t, Array_t >::m_size
protected

Number of elements in the array.

We keep it as 32 bits, so that small arrays may fit in 64 bits.


The documentation for this class was generated from the following file: