MaxMatrix
Drive chained 8x8 LED dot matrix modules with MAX7219.
Loading...
Searching...
No Matches
max_matrix::array< T, N > Struct Template Reference

A C array of N elements that knows its size. More...

#include <array.h>

Public Types

using value_type = T
using size_type = size_t

Public Member Functions

MAXMATRIX_NODISCARD constexpr size_type size () const
 Returns the number of elements, N.
T & operator[] (size_type index)
 Returns the element at index, unchecked.
constexpr T const & operator[] (size_type index) const
 Returns the element at index, unchecked.
MAXMATRIX_NODISCARD T * data ()
 Returns the address of the first element, as a C array gives it.
MAXMATRIX_NODISCARD constexpr T const * data () const
 Returns the address of the first element, as a C array gives it.

Public Attributes

T elements [N]
 The elements.

Detailed Description

template<typename T, size_t N>
struct max_matrix::array< T, N >

A C array of N elements that knows its size.

max_matrix::array<uint8_t, 3> const rows{{0x18, 0x3C, 0x18}};
A C array of N elements that knows its size.
Definition array.h:42

A struct with a public member, as std::array is: so it is an aggregate, is made as a C array is, and can lie in PROGMEM as one. A table in PROGMEM is made with make_array(), which counts its values.

Template Parameters
TThe type of the elements.
NThe number of elements, at least 1.
Differs from the standard:
Only size(), the index operator and data(): nothing in the library needs more yet. No array of no elements.

Member Typedef Documentation

◆ size_type

template<typename T, size_t N>
using max_matrix::array< T, N >::size_type = size_t

The type of a size and an index.

◆ value_type

template<typename T, size_t N>
using max_matrix::array< T, N >::value_type = T

The type of an element.

Member Function Documentation

◆ data()

template<typename T, size_t N>
MAXMATRIX_NODISCARD constexpr T const * max_matrix::array< T, N >::data ( ) const
inlineconstexpr

Returns the address of the first element, as a C array gives it.

◆ operator[]() [1/2]

template<typename T, size_t N>
T & max_matrix::array< T, N >::operator[] ( size_type index)
inline

Returns the element at index, unchecked.

Parameters
[in]indexThe position, from 0; below N.

◆ operator[]() [2/2]

template<typename T, size_t N>
T const & max_matrix::array< T, N >::operator[] ( size_type index) const
inlineconstexpr

Returns the element at index, unchecked.

Parameters
[in]indexThe position, from 0; below N.

Member Data Documentation

◆ elements

template<typename T, size_t N>
T max_matrix::array< T, N >::elements[N]

The elements.

Public, so that the array is an aggregate; use the index operator rather than this member.


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