31#ifndef ETL_ARRAY_WRAPPER_INCLUDED
32#define ETL_ARRAY_WRAPPER_INCLUDED
56 :
exception(reason_, file_name_, line_number_)
70 :
array_wrapper_exception(ETL_ERROR_TEXT(
"array_wrapper:bounds", ETL_ARRAY_WRAPPER_FILE_ID
"A"), file_name_, line_number_)
78 template <
typename T,
size_t SIZE_, T(&ARRAY_)[SIZE_]>
84 typedef size_t size_type;
86 typedef const T& const_reference;
88 typedef const T* const_pointer;
90 typedef const T* const_iterator;
91 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
92 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
114 return *&ARRAY_[FRONT];
120 ETL_CONSTEXPR const_reference
front()
const
122 return *&ARRAY_[FRONT];
130 return *&ARRAY_[BACK];
136 ETL_CONSTEXPR const_reference
back()
const
138 return *&ARRAY_[BACK];
146 return &ARRAY_[BEGIN];
152 ETL_CONSTEXPR const_pointer
data()
const
154 return &ARRAY_[BEGIN];
162 return &ARRAY_[BEGIN];
168 ETL_CONSTEXPR const_iterator
begin()
const
170 return &ARRAY_[BEGIN];
176 ETL_CONSTEXPR const_iterator
cbegin()
const
178 return &ARRAY_[BEGIN];
192 ETL_CONSTEXPR const_iterator
end()
const
200 ETL_CONSTEXPR const_iterator cend()
const
208 reverse_iterator rbegin()
210 return reverse_iterator(&ARRAY_[END]);
216 ETL_CONSTEXPR const_reverse_iterator rbegin()
const
218 return const_reverse_iterator(&ARRAY_[END]);
224 ETL_CONSTEXPR const_reverse_iterator
crbegin()
const
226 return const_reverse_iterator(&ARRAY_[END]);
234 return reverse_iterator(&ARRAY_[BEGIN]);
240 ETL_CONSTEXPR const_reverse_iterator
rend()
const
242 return const_reverse_iterator(&ARRAY_[BEGIN]);
248 ETL_CONSTEXPR const_reverse_iterator
crend()
const
250 return const_reverse_iterator(&ARRAY_[BEGIN]);
256 ETL_CONSTEXPR
size_t size()
const
288 reference
at(
size_t i)
297 const_reference
at(
size_t i)
const
314 template <
typename U, U(&ARRAYOTHER)[SIZE_]>
320 for (
size_t i = 0UL; i < SIZE; ++i)
330 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
334 return (SIZEL == SIZER) && etl::equal(lhs.
begin(), lhs.
end(), rhs.
begin());
340 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
344 return !(lhs == rhs);
350 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
354 return etl::lexicographical_compare(lhs.
begin(), lhs.
end(), rhs.
begin(), rhs.
end());
360 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
370 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
380 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
390#if ETL_USING_8BIT_TYPES
391 template <
typename T,
size_t SIZE, T(&ARRAY)[SIZE]>
392 struct hash<
etl::array_wrapper<T, SIZE, ARRAY> >
396 const uint8_t* pb =
reinterpret_cast<const uint8_t*
>(aw.
data());
397 const uint8_t* pe = pb + (SIZE *
sizeof(T));
399 return etl::private_hash::generic_hash<size_t>(pb, pe);
408template <
typename T,
size_t SIZE, T(&ARRAYL)[SIZE], T(&ARRAYR)[SIZE]>
415#define ETL_ARRAY_WRAPPER(arraytype, arrayobject) etl::array_wrapper<arraytype, ETL_ARRAY_SIZE(arrayobject), arrayobject>
void swap(etl::array_wrapper< T, SIZE, ARRAYL > &lhs, etl::array_wrapper< T, SIZE, ARRAYR > &rhs)
Swap.
Definition: array_wrapper.h:409
The base class for array_wrapper exceptions.
Definition: array_wrapper.h:52
Array wrapper.
Definition: array_wrapper.h:80
iterator end()
Returns an iterator to the end of the array.
Definition: array_wrapper.h:184
reference back()
Returns a reference to the last element.
Definition: array_wrapper.h:128
iterator begin()
Returns an iterator to the beginning of the array.
Definition: array_wrapper.h:160
reference front()
Returns a reference to the first element.
Definition: array_wrapper.h:112
ETL_CONSTEXPR const_iterator cbegin() const
Returns a const iterator to the beginning of the array.
Definition: array_wrapper.h:176
ETL_CONSTEXPR const_reverse_iterator crend() const
Returns a const reverse iterator to the end of the array.
Definition: array_wrapper.h:248
void fill(parameter_t value)
Fills the array.
Definition: array_wrapper.h:306
reference operator[](size_t i)
Returns a reference to the indexed value.
Definition: array_wrapper.h:272
pointer data()
Returns a pointer to the first element of the internal storage.
Definition: array_wrapper.h:144
ETL_CONSTEXPR const_reverse_iterator crbegin() const
Returns a const reverse iterator to the reverse beginning of the array.
Definition: array_wrapper.h:224
etl::enable_if< etl::is_same< T, U >::value, void >::type swap(etl::array_wrapper< U, SIZE_, ARRAYOTHER > &other)
Swaps the contents of arrays.
Definition: array_wrapper.h:316
const_reference at(size_t i) const
Returns a const reference to the indexed value.
Definition: array_wrapper.h:297
ETL_CONSTEXPR size_t max_size() const
Returns the maximum possible size of the array.
Definition: array_wrapper.h:264
reverse_iterator rend()
Returns a reverse iterator to the end of the array.
Definition: array_wrapper.h:232
ETL_CONSTEXPR size_t size() const
Returns the size of the array.
Definition: array_wrapper.h:256
reference at(size_t i)
Returns a reference to the indexed value.
Definition: array_wrapper.h:288
#define ETL_ASSERT(b, e)
Definition: error_handler.h:316
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition: exception.h:69
Definition: exception.h:47
Definition: array_wrapper.h:66
enable_if
Definition: type_traits_generator.h:1191
bitset_ext
Definition: absolute.h:38
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:684
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:696
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:645
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:633
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:657
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:672
etl::conditional< etl::is_fundamental< T >::value||etl::is_pointer< T >::value, T, constT & >::type type
By default fundamental and pointer types are passed by value.
Definition: parameter_type.h:48