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
274 reference
operator[](
size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
285 ETL_CONSTEXPR const_reference
operator[](
size_t i)
const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS || ETL_NOT_CHECKING_INDEX_OPERATOR)
288#if ETL_USING_CPP11 && ETL_NOT_USING_CPP14 && ETL_USING_EXCEPTIONS && ETL_CHECKING_INDEX_OPERATOR
299 reference
at(
size_t i)
308 const_reference
at(
size_t i)
const
325 template <
typename U, U (&ARRAYOTHER)[SIZE_]>
328 using ETL_OR_STD::swap;
330 for (
size_t i = 0UL; i < SIZE; ++i)
340 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
343 return (SIZEL == SIZER) && etl::equal(lhs.
begin(), lhs.
end(), rhs.
begin());
349 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
352 return !(lhs == rhs);
358 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
361 return etl::lexicographical_compare(lhs.
begin(), lhs.
end(), rhs.
begin(), rhs.
end());
367 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
376 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
385 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL (&ARRAYL)[SIZEL], TR (&ARRAYR)[SIZER]>
394#if ETL_USING_8BIT_TYPES
395 template <
typename T,
size_t SIZE, T (&ARRAY)[SIZE]>
396 struct hash<
etl::array_wrapper<T, SIZE, ARRAY> >
400 const uint8_t* pb =
reinterpret_cast<const uint8_t*
>(aw.
data());
401 const uint8_t* pe = pb + (SIZE *
sizeof(T));
403 return etl::private_hash::generic_hash<size_t>(pb, pe);
412template <
typename T,
size_t SIZE, T (&ARRAYL)[SIZE], T (&ARRAYR)[SIZE]>
418#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:413
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
reference operator[](size_t i) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_INDEX_OPERATOR)
Definition array_wrapper.h:274
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
ETL_CONSTEXPR const_reference operator[](size_t i) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS||ETL_NOT_CHECKING_INDEX_OPERATOR)
Definition array_wrapper.h:285
void fill(parameter_t value)
Fills the array.
Definition array_wrapper.h:317
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:326
const_reference at(size_t i) const
Returns a const reference to the indexed value.
Definition array_wrapper.h:308
reference at(size_t i)
Returns a reference to the indexed value.
Definition array_wrapper.h:299
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
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition array_wrapper.h:66
bitset_ext
Definition absolute.h:40
ETL_CONSTEXPR14 bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1081
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1133
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1147
ETL_CONSTEXPR14 bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1093
ETL_CONSTEXPR TContainer::const_iterator cend(const TContainer &container)
Definition iterator.h:1017
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1106
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1120
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:46