31#ifndef ETL_ARRAY_WRAPPER_INCLUDED
32#define ETL_ARRAY_WRAPPER_INCLUDED
55 array_wrapper_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
56 :
exception(reason_, file_name_, line_number_)
65 class array_wrapper_bounds :
public array_wrapper_exception
69 array_wrapper_bounds(string_type file_name_, numeric_type 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 ETL_NOEXCEPT
154 return &ARRAY_[BEGIN];
162 return &ARRAY_[BEGIN];
168 ETL_CONSTEXPR const_iterator
begin() const ETL_NOEXCEPT
170 return &ARRAY_[BEGIN];
176 ETL_CONSTEXPR const_iterator
cbegin() const ETL_NOEXCEPT
178 return &ARRAY_[BEGIN];
184 iterator
end() ETL_NOEXCEPT
192 ETL_CONSTEXPR const_iterator
end() const ETL_NOEXCEPT
208 reverse_iterator
rbegin() ETL_NOEXCEPT
210 return reverse_iterator(&ARRAY_[END]);
216 ETL_CONSTEXPR const_reverse_iterator
rbegin() const ETL_NOEXCEPT
218 return const_reverse_iterator(&ARRAY_[END]);
224 ETL_CONSTEXPR const_reverse_iterator
crbegin() const ETL_NOEXCEPT
226 return const_reverse_iterator(&ARRAY_[END]);
232 reverse_iterator
rend() ETL_NOEXCEPT
234 return reverse_iterator(&ARRAY_[BEGIN]);
240 ETL_CONSTEXPR const_reverse_iterator
rend() const ETL_NOEXCEPT
242 return const_reverse_iterator(&ARRAY_[BEGIN]);
248 ETL_CONSTEXPR const_reverse_iterator
crend() const ETL_NOEXCEPT
250 return const_reverse_iterator(&ARRAY_[BEGIN]);
256 ETL_CONSTEXPR
size_t size() const ETL_NOEXCEPT
280 ETL_CONSTEXPR const_reference
operator[](
size_t i)
const ETL_NOEXCEPT
288 reference
at(
size_t i)
297 const_reference
at(
size_t i)
const
314 template <
typename U, U(&ARRAYOTHER)[SIZE_]>
318 using ETL_OR_STD::swap;
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
Array wrapper.
Definition array_wrapper.h:80
ETL_CONSTEXPR const_reverse_iterator crend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array_wrapper.h:248
reference back()
Returns a reference to the last element.
Definition array_wrapper.h:128
reference front()
Returns a reference to the first element.
Definition array_wrapper.h:112
ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array_wrapper.h:176
reverse_iterator rend() ETL_NOEXCEPT
Returns a reverse iterator to the end of the array.
Definition array_wrapper.h:232
ETL_CONSTEXPR const_reference back() const
Returns a const reference to the last element.
Definition array_wrapper.h:136
ETL_CONSTEXPR const_reference front() const
Returns a const reference to the first element.
Definition array_wrapper.h:120
ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT
Returns a const pointer to the first element of the internal storage.
Definition array_wrapper.h:152
void fill(parameter_t value)
Fills the array.
Definition array_wrapper.h:306
iterator end() ETL_NOEXCEPT
Returns an iterator to the end of the array.
Definition array_wrapper.h:184
ETL_CONSTEXPR const_reverse_iterator rbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array_wrapper.h:216
ETL_CONSTEXPR const_reverse_iterator rend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array_wrapper.h:240
ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT
Returns a const iterator to the end of the array.
Definition array_wrapper.h:192
ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
Returns the maximum possible size of the array.
Definition array_wrapper.h:264
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
reference at(size_t i)
Returns a reference to the indexed value.
Definition array_wrapper.h:288
ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
Returns the size of the array.
Definition array_wrapper.h:256
iterator begin() ETL_NOEXCEPT
Returns an iterator to the beginning of the array.
Definition array_wrapper.h:160
pointer data() ETL_NOEXCEPT
Returns a pointer to the first element of the internal storage.
Definition array_wrapper.h:144
ETL_CONSTEXPR const_reverse_iterator crbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array_wrapper.h:224
ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array_wrapper.h:168
ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT
Returns a const reference to the indexed value.
Definition array_wrapper.h:280
reference operator[](size_t i) ETL_NOEXCEPT
Returns a reference to the indexed value.
Definition array_wrapper.h:272
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition exception.h:69
Definition array_wrapper.h:66
enable_if
Definition type_traits_generator.h:1254
bitset_ext
Definition absolute.h:39
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1190
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1202
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1151
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1139
ETL_CONSTEXPR TContainer::const_iterator cend(const TContainer &container)
Definition iterator.h:1012
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1163
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1178
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