20#include "initializer_list.h"
33 template<
typename T_, u
int8_t N_>
40 static constexpr uint8_t
N = N_;
61 const T* src = buffer;
62 for (uint8_t i = 0; i <
N; ++i)
74 auto src = list.
begin();
75 for (uint8_t i = 0; i <
N; ++i)
77 if (src != list.
end())
90 const T* src = that.buffer_;
91 for (uint8_t i = 0; i <
N; ++i)
101 const T* src = buffer;
102 for (uint8_t i = 0; i <
N; ++i)
115 auto src = list.
begin();
116 for (uint8_t i = 0; i <
N; ++i)
118 if (src != list.
end())
130 if (
this == &that)
return *
this;
132 const T* src = that.buffer_;
133 for (uint8_t i = 0; i <
N; ++i)
172 return buffer_[index];
184 return buffer_[index];
216 void set(uint8_t index,
const T (&buffer)[NN])
218 if (index >=
N)
return;
219 const uint8_t nn = ((
N - index) < NN) ? (
N - index) : NN;
220 T* dst = &buffer_[index];
221 const T* src = buffer;
222 for (uint8_t i = 0; i < nn; ++i)
233 if (index >=
N)
return;
234 const uint8_t nn = ((
N - index) < NN) ? (
N - index) : NN;
235 T* dst = &buffer_[index];
236 const T* src = buffer.
data();
237 for (uint8_t i = 0; i < nn; ++i)
Container that encapsulates a fixed size array.
array()=default
Create a default array of N elements of type T.
array(T buffer[N])
Convert a C-style array to an array.
void set(uint8_t index, const array< T, NN > &buffer)
Replace NN elements of this array, starting at index element, with elements from buffer.
CTPTR data() const
Get a const pointer to the first element of this array.
TPTR begin()
Return an iterator to the first element of this array.
T_ & TREF
The reference type to T.
array & operator=(const array &that)
Overwrite every element of this array with every element of that.
constexpr uint8_t size() const
Get the number of elements in this array.
array(std::initializer_list< T > list)
Create an array from a braced-list of elements.
CTREF operator[](uint8_t index) const
Get a const reference to the element at index in this array.
CTPTR end() const
Return a const iterator to the last element of this array.
array(const array< T, N > &that)
Copy that array.
CTPTR begin() const
Return a const iterator to the first element of this array.
TPTR end()
Return an iterator to the last element of this array.
array< T, N > & operator=(const T buffer[N])
Overwrite every element of this array with every element of buffer.
T_ * TPTR
The pointer type to T.
const T_ * CTPTR
The const pointer type to T.
T_ T
The type of elements held by this array.
static constexpr uint8_t N
The number of elements in this array.
TREF operator[](uint8_t index)
Get a reference to the element at index in this array.
void set(uint8_t index, const T(&buffer)[NN])
Replace NN elements of this array, starting at index element, with elements from buffer.
TPTR data()
Get a pointer to the first element of this array.
const T_ & CTREF
The const reference type to T.
array< T, N > & operator=(std::initializer_list< T > list)
Overwrite every element of this array with every element of list.
C++ standard support for "initializer_list".
constexpr const T * begin() const
The first element of this initializer_list.
constexpr const T * end() const
One past the last element of this initializer_list.
Contains all FastArduino generic containers: