This is an old version of the documentation. View the latest version here.
Control Surface  1.0.0
MIDI Control Surface library for Arduino
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Array< T, N > Struct Template Reference

An array wrapper for easy copying, comparing, and iterating. More...

#include <Array.hpp>

Collaboration diagram for Array< T, N >:

Public Types

using type = T
 

Public Member Functions

T & operator[] (size_t index)
 Get the element at the given index. More...
 
const T & operator[] (size_t index) const
 Get the element at the given index. More...
 
T * begin ()
 Get a pointer to the first element. More...
 
const T * begin () const
 Get a pointer to the first element. More...
 
T * end ()
 Get a pointer to the memory beyond the array. More...
 
const T * end () const
 Get a pointer to the memory beyond the array. More...
 
bool operator== (const Array< T, N > &rhs) const
 Check the equality of all elements in two arrays. More...
 
bool operator!= (const Array< T, N > &rhs) const
 Check the inequality of all elements in two arrays. More...
 

Public Attributes

data [N]
 

Static Public Attributes

constexpr static size_t length = N
 

Detailed Description

template<class T, size_t N>
struct Array< T, N >

An array wrapper for easy copying, comparing, and iterating.

Template Parameters
TThe type of the elements in the array.
NThe number of elements in the array.
Examples
10.Note-FastLED-ColorMapper.ino, 9.Note-FastLED.ino, and Bank-Button-Matrix.ino.

Definition at line 20 of file Array.hpp.

Member Typedef Documentation

◆ type

template<class T, size_t N>
using Array< T, N >::type = T

Definition at line 22 of file Array.hpp.

Member Function Documentation

◆ operator[]() [1/2]

template<class T, size_t N>
T& Array< T, N >::operator[] ( size_t  index)
inline

Get the element at the given index.

Note
Bounds checking is performed. If fatal errors are disabled, the last element is returned if the index is out of bounds.
Parameters
indexThe (zero-based) index of the element to return.

Definition at line 34 of file Array.hpp.

◆ operator[]() [2/2]

template<class T, size_t N>
const T& Array< T, N >::operator[] ( size_t  index) const
inline

Get the element at the given index.

Note
Bounds checking is performed. If fatal errors are disabled, the last element is returned if the index is out of bounds.
Parameters
indexThe (zero-based) index of the element to return.

Definition at line 51 of file Array.hpp.

◆ begin() [1/2]

template<class T, size_t N>
T* Array< T, N >::begin ( )
inline

Get a pointer to the first element.

Definition at line 62 of file Array.hpp.

◆ begin() [2/2]

template<class T, size_t N>
const T* Array< T, N >::begin ( ) const
inline

Get a pointer to the first element.

Definition at line 67 of file Array.hpp.

◆ end() [1/2]

template<class T, size_t N>
T* Array< T, N >::end ( )
inline

Get a pointer to the memory beyond the array.

Definition at line 72 of file Array.hpp.

◆ end() [2/2]

template<class T, size_t N>
const T* Array< T, N >::end ( ) const
inline

Get a pointer to the memory beyond the array.

Definition at line 77 of file Array.hpp.

◆ operator==()

template<class T, size_t N>
bool Array< T, N >::operator== ( const Array< T, N > &  rhs) const
inline

Check the equality of all elements in two arrays.

Parameters
rhsThe array to compare this array to.

Definition at line 85 of file Array.hpp.

◆ operator!=()

template<class T, size_t N>
bool Array< T, N >::operator!= ( const Array< T, N > &  rhs) const
inline

Check the inequality of all elements in two arrays.

Parameters
rhsThe array to compare this array to.

Definition at line 100 of file Array.hpp.

Member Data Documentation

◆ data

template<class T, size_t N>
T Array< T, N >::data[N]

Definition at line 21 of file Array.hpp.

◆ length

template<class T, size_t N>
constexpr static size_t Array< T, N >::length = N
staticconstexpr

Definition at line 23 of file Array.hpp.


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