31 #ifndef ETL_ARRAY_WRAPPER_INCLUDED
32 #define ETL_ARRAY_WRAPPER_INCLUDED
61 :
exception(reason_, file_name_, line_number_)
83 template <
typename T,
size_t SIZE_, T(&ARRAY_)[SIZE_]>
89 typedef size_t size_type;
91 typedef const T& const_reference;
93 typedef const T* const_pointer;
95 typedef const T* const_iterator;
96 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
97 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
119 return *&ARRAY_[FRONT];
125 ETL_CONSTEXPR const_reference
front()
const
127 return *&ARRAY_[FRONT];
135 return *&ARRAY_[BACK];
141 ETL_CONSTEXPR const_reference
back()
const
143 return *&ARRAY_[BACK];
151 return &ARRAY_[BEGIN];
157 ETL_CONSTEXPR const_pointer
data()
const
159 return &ARRAY_[BEGIN];
167 return &ARRAY_[BEGIN];
173 ETL_CONSTEXPR const_iterator
begin()
const
175 return &ARRAY_[BEGIN];
181 ETL_CONSTEXPR const_iterator
cbegin()
const
183 return &ARRAY_[BEGIN];
197 ETL_CONSTEXPR const_iterator
end()
const
205 ETL_CONSTEXPR const_iterator cend()
const
213 reverse_iterator rbegin()
215 return reverse_iterator(&ARRAY_[END]);
221 ETL_CONSTEXPR const_reverse_iterator rbegin()
const
223 return const_reverse_iterator(&ARRAY_[END]);
229 ETL_CONSTEXPR const_reverse_iterator
crbegin()
const
231 return const_reverse_iterator(&ARRAY_[END]);
239 return reverse_iterator(&ARRAY_[BEGIN]);
245 ETL_CONSTEXPR const_reverse_iterator
rend()
const
247 return const_reverse_iterator(&ARRAY_[BEGIN]);
253 ETL_CONSTEXPR const_reverse_iterator
crend()
const
255 return const_reverse_iterator(&ARRAY_[BEGIN]);
261 ETL_CONSTEXPR
size_t size()
const
293 reference
at(
size_t i)
302 const_reference
at(
size_t i)
const
319 template <
typename U, U(&ARRAYOTHER)[SIZE_]>
325 for (
size_t i = 0; i < SIZE; ++i)
335 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
339 return (SIZEL == SIZER) && etl::equal(lhs.
begin(), lhs.
end(), rhs.
begin());
345 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
349 return !(lhs == rhs);
355 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
359 return etl::lexicographical_compare(lhs.
begin(), lhs.
end(), rhs.
begin(), rhs.
end());
365 template <
typename TL,
typename TR,
size_t SIZEL,
size_t SIZER, TL(&ARRAYL)[SIZEL], TR(&ARRAYR)[SIZER]>
375 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]>
396 template <
typename T,
size_t SIZE, T(&ARRAY)[SIZE]>
397 struct hash<
etl::array_wrapper<T, SIZE, ARRAY> >
401 return etl::private_hash::generic_hash<size_t>(
reinterpret_cast<const uint8_t*
>(&aw[0]),
402 reinterpret_cast<const uint8_t*
>(&aw[aw.
size()]));
411 template <
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:412
The base class for array_wrapper exceptions.
Definition: array_wrapper.h:57
Array wrapper.
Definition: array_wrapper.h:85
iterator end()
Returns an iterator to the end of the array.
Definition: array_wrapper.h:189
reference back()
Returns a reference to the last element.
Definition: array_wrapper.h:133
iterator begin()
Returns an iterator to the beginning of the array.
Definition: array_wrapper.h:165
reference front()
Returns a reference to the first element.
Definition: array_wrapper.h:117
ETL_CONSTEXPR const_iterator cbegin() const
Returns a const iterator to the beginning of the array.
Definition: array_wrapper.h:181
ETL_CONSTEXPR const_reverse_iterator crend() const
Returns a const reverse iterator to the end of the array.
Definition: array_wrapper.h:253
void fill(parameter_t value)
Fills the array.
Definition: array_wrapper.h:311
reference operator[](size_t i)
Returns a reference to the indexed value.
Definition: array_wrapper.h:277
pointer data()
Returns a pointer to the first element of the internal storage.
Definition: array_wrapper.h:149
ETL_CONSTEXPR const_reverse_iterator crbegin() const
Returns a const reverse iterator to the reverse beginning of the array.
Definition: array_wrapper.h:229
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:321
const_reference at(size_t i) const
Returns a const reference to the indexed value.
Definition: array_wrapper.h:302
ETL_CONSTEXPR size_t max_size() const
Returns the maximum possible size of the array.
Definition: array_wrapper.h:269
reverse_iterator rend()
Returns a reverse iterator to the end of the array.
Definition: array_wrapper.h:237
ETL_CONSTEXPR size_t size() const
Returns the size of the array.
Definition: array_wrapper.h:261
reference at(size_t i)
Returns a reference to the indexed value.
Definition: array_wrapper.h:293
#define ETL_ASSERT(b, e)
Definition: error_handler.h:290
exception(string_type reason_, string_type file_, numeric_type line_)
Constructor.
Definition: exception.h:67
Definition: exception.h:47
Definition: array_wrapper.h:71
enable_if
Definition: type_traits_generator.h:1228
Definition: absolute.h:37
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:645
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:594
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:582
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:606
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition: array.h:621
etl::conditional< etl::is_fundamental< T >::value||etl::is_pointer< T >::value, T, const T & >::type type
By default fundamental and pointer types are passed by value.
Definition: parameter_type.h:48