31#ifndef ETL_ARRAY_INCLUDED
32#define ETL_ARRAY_INCLUDED
41#include "static_assert.h"
86 template <
typename T,
size_t SIZE_>
95 static ETL_CONSTANT
size_t SIZE =
SIZE_;
98 typedef size_t size_type;
100 typedef T& reference;
101 typedef const T& const_reference;
103 typedef const T* const_pointer;
105 typedef const T* const_iterator;
106 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
107 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
119 reference
at(
size_t i)
132 const_reference
at(
size_t i)
const
176 ETL_CONSTEXPR const_reference
front()
const
195 ETL_CONSTEXPR const_reference
back()
const
256 iterator
end() ETL_NOEXCEPT
265 ETL_CONSTEXPR const_iterator
end()
const ETL_NOEXCEPT
274 ETL_CONSTEXPR const_iterator cend()
const ETL_NOEXCEPT
284 reverse_iterator rbegin() ETL_NOEXCEPT
286 return reverse_iterator(
end());
295 return const_reverse_iterator(
end());
304 return const_reverse_iterator(
end());
312 reverse_iterator
rend() ETL_NOEXCEPT
314 return reverse_iterator(
begin());
321 ETL_CONSTEXPR const_reverse_iterator
rend()
const ETL_NOEXCEPT
323 return const_reverse_iterator(
begin());
330 ETL_CONSTEXPR const_reverse_iterator
crend()
const ETL_NOEXCEPT
332 return const_reverse_iterator(
begin());
374 ETL_CONSTEXPR14
void fill(parameter_t value)
385 using ETL_OR_STD::swap;
387 for (
size_t i = 0
UL; i < SIZE; ++i)
400 template <
typename TIterator>
413 template <
typename TIterator>
420 etl::fill(p,
end(), value);
430 inline iterator
insert_at(
size_t position, parameter_t value)
440 iterator
insert(const_iterator position, parameter_t value)
442 iterator p = to_iterator(position);
444 etl::move_backward(p,
end() - 1,
end());
456 template <
typename TIterator>
468 template <
typename TIterator>
471 iterator p = to_iterator(position);
481 etl::move_backward(p, p + length,
end());
505 iterator
erase(const_iterator position)
507 iterator p = to_iterator(position);
508 etl::move(p + 1,
end(), p);
530 iterator
erase(const_iterator first, const_iterator last)
532 iterator p = to_iterator(first);
533 etl::move(last, cend(), p);
542 inline iterator
erase_at(
size_t position, parameter_t value)
552 iterator
erase(const_iterator position, parameter_t value)
554 iterator p = to_iterator(position);
556 etl::move(p + 1,
end(), p);
568 iterator
erase_range(
size_t first,
size_t last, parameter_t value)
578 iterator
erase(const_iterator first, const_iterator last, parameter_t value)
580 iterator p = to_iterator(first);
582 p = etl::move(last, cend(), p);
583 etl::fill(p,
end(), value);
585 return to_iterator(first);
596 iterator to_iterator(const_iterator itr)
const
598 return const_cast<iterator
>(itr);
602 template <
typename T,
size_t SIZE_>
603 ETL_CONSTANT
size_t array<T, SIZE_>::SIZE;
610 template <
typename T>
619 static ETL_CONSTANT
size_t SIZE = 0;
621 typedef T value_type;
622 typedef size_t size_type;
624 typedef T& reference;
625 typedef const T& const_reference;
627 typedef const T* const_pointer;
629 typedef const T* const_iterator;
630 typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
631 typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
654 const_reference
at(
size_t)
const
696 ETL_CONSTEXPR const_reference
front()
const
715 ETL_CONSTEXPR const_reference
back()
const
759 return const_iterator();
768 return const_iterator();
776 iterator
end() ETL_NOEXCEPT
785 ETL_CONSTEXPR const_iterator
end()
const ETL_NOEXCEPT
787 return const_iterator();
794 ETL_CONSTEXPR const_iterator cend()
const ETL_NOEXCEPT
796 return const_iterator();
804 reverse_iterator rbegin() ETL_NOEXCEPT
806 return reverse_iterator(
end());
815 return const_reverse_iterator(
end());
824 return const_reverse_iterator(
end());
832 reverse_iterator
rend() ETL_NOEXCEPT
834 return reverse_iterator(
begin());
841 ETL_CONSTEXPR const_reverse_iterator
rend()
const ETL_NOEXCEPT
843 return const_reverse_iterator(
begin());
850 ETL_CONSTEXPR const_reverse_iterator
crend()
const ETL_NOEXCEPT
852 return const_reverse_iterator(
begin());
894 ETL_CONSTEXPR14
void fill(parameter_t)
913 template <
typename TIterator>
926 template <
typename TIterator>
947 iterator
insert(const_iterator, parameter_t)
958 template <
typename TIterator>
970 template <
typename TIterator>
1013 iterator
erase(const_iterator, const_iterator)
1033 iterator
erase(const_iterator, parameter_t)
1054 iterator
erase(const_iterator, const_iterator, parameter_t)
1064 template <
typename...
T>
1071#if ETL_HAS_INITIALIZER_LIST
1072 template <
typename T,
typename...
TValues>
1084 template <
typename T, const
size_t SIZE>
1096 template <
typename T,
size_t SIZE>
1099 return etl::equal(
lhs.cbegin(),
lhs.cend(),
rhs.cbegin());
1108 template <
typename T,
size_t SIZE>
1120 template <
typename T,
size_t SIZE>
1123 return etl::lexicographical_compare(
lhs.cbegin(),
1135 template <
typename T,
size_t SIZE>
1146 template <
typename T,
size_t SIZE>
1159 template <
typename T,
size_t SIZE>
1173 template <
size_t I,
typename T,
size_t MAXN>
1176 ETL_STATIC_ASSERT(
I <
MAXN,
"Index out of bounds");
1188 template <
size_t I,
typename T,
size_t MAXN>
1191 ETL_STATIC_ASSERT(
I <
MAXN,
"Index out of bounds");
ETL_CONSTEXPR14 etl::enable_if< etl::is_random_iterator< TInputIterator >::value &&etl::is_random_iterator< TOutputIterator >::value, TOutputIterator >::type copy_s(TInputIterator i_begin, TInputIterator i_end, TOutputIterator o_begin, TOutputIterator o_end)
Definition algorithm.h:2368
ETL_NODISCARD ETL_CONSTEXPR const_reference back() const
Returns a const reference to the last element.
Definition array.h:195
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array.h:841
ETL_NODISCARD ETL_CONSTEXPR14 reference front()
Returns a reference to the first element.
Definition array.h:687
iterator erase(const_iterator first, const_iterator last)
Definition array.h:530
iterator insert_at(size_t, TIterator, const TIterator)
Definition array.h:959
ETL_CONSTEXPR14 void swap(array &other) ETL_NOEXCEPT
Definition array.h:383
ETL_NODISCARD ETL_CONSTEXPR14 reverse_iterator rend() ETL_NOEXCEPT
Returns a reverse iterator to the end of the array.
Definition array.h:312
iterator insert(const_iterator, parameter_t)
Definition array.h:947
ETL_NODISCARD ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT
Returns a const pointer to the first element of the internal buffer.
Definition array.h:734
iterator assign(TIterator, const TIterator)
Definition array.h:914
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array.h:302
ETL_NODISCARD ETL_CONSTEXPR14 reference at(size_t)
Definition array.h:643
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array.h:293
ETL_NODISCARD ETL_CONSTEXPR14 iterator end() ETL_NOEXCEPT
Returns an iterator to the end of the array.
Definition array.h:776
ETL_NODISCARD ETL_CONSTEXPR14 iterator begin() ETL_NOEXCEPT
Returns an iterator to the beginning of the array.
Definition array.h:228
T _buffer[SIZE]
The array data.
Definition array.h:589
ETL_NODISCARD ETL_CONSTEXPR14 reference back()
Returns a reference to the last element.
Definition array.h:186
ETL_NODISCARD ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array.h:237
iterator erase(const_iterator)
Definition array.h:991
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array.h:850
ETL_NODISCARD ETL_CONSTEXPR14 const_reference at(size_t i) const
Definition array.h:132
ETL_NODISCARD ETL_CONSTEXPR14 reference at(size_t i)
Definition array.h:119
ETL_NODISCARD ETL_CONSTEXPR14 pointer data() ETL_NOEXCEPT
Returns a pointer to the first element of the internal buffer.
Definition array.h:205
ETL_NODISCARD ETL_CONSTEXPR14 reference front()
Returns a reference to the first element.
Definition array.h:167
iterator insert_at(size_t, parameter_t)
Definition array.h:937
iterator erase_range(size_t first, size_t last)
Definition array.h:519
iterator erase_range(size_t, size_t, parameter_t)
Definition array.h:1044
ETL_NODISCARD ETL_CONSTEXPR const_reference operator[](size_t) const
Definition array.h:677
ETL_NODISCARD ETL_CONSTEXPR14 iterator begin() ETL_NOEXCEPT
Returns an iterator to the beginning of the array.
Definition array.h:748
ETL_CONSTEXPR14 void fill(parameter_t value)
Definition array.h:374
iterator insert_at(size_t position, parameter_t value)
Definition array.h:430
iterator erase_range(size_t first, size_t last, parameter_t value)
Definition array.h:568
ETL_NODISCARD ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT
Returns a const iterator to the end of the array.
Definition array.h:265
ETL_NODISCARD ETL_CONSTEXPR const_reference front() const
Returns a const reference to the first element.
Definition array.h:176
iterator erase(const_iterator, const_iterator, parameter_t)
Definition array.h:1054
ETL_NODISCARD ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
Returns the maximum possible size of the array.
Definition array.h:881
ETL_CONSTEXPR14 void fill(parameter_t)
Definition array.h:894
ETL_NODISCARD ETL_CONSTEXPR14 reference back()
Returns a reference to the last element.
Definition array.h:706
ETL_NODISCARD ETL_CONSTEXPR const_iterator end() const ETL_NOEXCEPT
Returns a const iterator to the end of the array.
Definition array.h:785
ETL_NODISCARD ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
Returns the size of the array.
Definition array.h:872
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array.h:822
ETL_CONSTEXPR14 void swap(array &) ETL_NOEXCEPT
Definition array.h:902
iterator erase_at(size_t position)
Definition array.h:495
iterator erase_at(size_t)
Definition array.h:981
ETL_NODISCARD ETL_CONSTEXPR const_reference back() const
Returns a const reference to the last element.
Definition array.h:715
iterator erase(const_iterator first, const_iterator last, parameter_t value)
Definition array.h:578
iterator erase(const_iterator position, parameter_t value)
Definition array.h:552
iterator erase_range(size_t, size_t)
Definition array.h:1002
ETL_NODISCARD ETL_CONSTEXPR14 pointer data() ETL_NOEXCEPT
Returns a pointer to the first element of the internal buffer.
Definition array.h:725
ETL_NODISCARD ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array.h:766
ETL_NODISCARD ETL_CONSTEXPR14 iterator end() ETL_NOEXCEPT
Returns an iterator to the end of the array.
Definition array.h:256
iterator insert(const_iterator position, parameter_t value)
Definition array.h:440
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator crend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array.h:330
ETL_NODISCARD ETL_CONSTEXPR const_iterator begin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array.h:757
ETL_NODISCARD ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
Returns true if the array size is zero.
Definition array.h:343
iterator assign(TIterator, const TIterator, parameter_t)
Definition array.h:927
ETL_NODISCARD ETL_CONSTEXPR const_pointer data() const ETL_NOEXCEPT
Returns a const pointer to the first element of the internal buffer.
Definition array.h:214
ETL_NODISCARD ETL_CONSTEXPR const_reference front() const
Returns a const reference to the first element.
Definition array.h:696
ETL_NODISCARD ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
Returns the size of the array.
Definition array.h:352
ETL_NODISCARD ETL_CONSTEXPR const_reference operator[](size_t i) const
Definition array.h:157
iterator insert(const_iterator position, TIterator first, const TIterator last)
Definition array.h:469
iterator assign(TIterator first, const TIterator last)
Definition array.h:401
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rbegin() const ETL_NOEXCEPT
Returns a const reverse iterator to the reverse beginning of the array.
Definition array.h:813
iterator erase(const_iterator, parameter_t)
Definition array.h:1033
iterator erase_at(size_t, parameter_t)
Definition array.h:1023
iterator erase(const_iterator, const_iterator)
Definition array.h:1013
ETL_NODISCARD ETL_CONSTEXPR const_iterator cbegin() const ETL_NOEXCEPT
Returns a const iterator to the beginning of the array.
Definition array.h:246
iterator erase(const_iterator position)
Definition array.h:505
iterator assign(TIterator first, const TIterator last, parameter_t value)
Definition array.h:414
ETL_NODISCARD ETL_CONSTEXPR14 reverse_iterator rend() ETL_NOEXCEPT
Returns a reverse iterator to the end of the array.
Definition array.h:832
ETL_NODISCARD ETL_CONSTEXPR14 reference operator[](size_t i)
Definition array.h:146
iterator erase_at(size_t position, parameter_t value)
Definition array.h:542
iterator insert_at(size_t position, TIterator first, const TIterator last)
Definition array.h:457
iterator insert(const_iterator, TIterator, const TIterator)
Definition array.h:971
ETL_NODISCARD ETL_CONSTEXPR14 reference operator[](size_t)
Definition array.h:666
ETL_NODISCARD ETL_CONSTEXPR14 const_reference at(size_t) const
Definition array.h:654
ETL_NODISCARD ETL_CONSTEXPR const_reverse_iterator rend() const ETL_NOEXCEPT
Returns a const reverse iterator to the end of the array.
Definition array.h:321
ETL_NODISCARD ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
Returns true if the array size is zero.
Definition array.h:863
ETL_NODISCARD ETL_CONSTEXPR size_t max_size() const ETL_NOEXCEPT
Returns the maximum possible size of the array.
Definition array.h:361
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
Definition exception.h:47
bitset_ext
Definition absolute.h:38
bool operator>(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1148
T & get(array< T, MAXN > &a)
Definition array.h:1174
bool operator>=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1160
bool operator!=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1109
void swap(etl::array< T, SIZE > &lhs, etl::array< T, SIZE > &rhs)
Template deduction guides.
Definition array.h:1085
bool operator==(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1097
ETL_NODISCARD ETL_CONSTEXPR14 T round_half_even_unscaled(T value) ETL_NOEXCEPT
Definition scaled_rounding.h:314
bool operator<(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1121
bool operator<=(const etl::array< T, SIZE > &lhs, const etl::array< T, SIZE > &rhs)
Definition array.h:1136
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