3#ifndef TETL_ARRAY_ARRAY_HPP
4#define TETL_ARRAY_ARRAY_HPP
47template <
typename Type,
size_t Size>
64 if constexpr (Size == 0) {
75 if constexpr (Size == 0) {
110 if constexpr (Size == 0) {
120 if constexpr (Size == 0) {
133 if constexpr (Size == 0) {
143 if constexpr (Size == 0) {
193 [[nodiscard]]
constexpr auto empty() const noexcept ->
bool {
return begin() ==
end(); }
196 [[nodiscard]]
constexpr auto size() const noexcept ->
size_type {
return Size; }
218 friend constexpr auto swap(
array& lhs,
array& rhs)
noexcept(
noexcept(lhs.swap(rhs))) ->
void { lhs.swap(rhs); }
225 return etl::equal(lhs.begin(), lhs.end(), rhs.begin());
251template <
typename T,
typename... U>
257template <
typename T,
size_t N>
261template <
typename T, etl::
size_t Size>
266template <
size_t I,
typename T>
269template <
size_t I,
typename T,
size_t N>
278template <
size_t Index,
typename T,
size_t Size>
281 static_assert(Index < Size,
"array index out of range");
286template <
size_t Index,
typename T,
size_t Size>
289 static_assert(Index < Size,
"array index out of range");
294template <
size_t Index,
typename T,
size_t Size>
297 static_assert(Index < Size,
"array index out of range");
302template <
size_t Index,
typename T,
size_t Size>
305 static_assert(Index < Size,
"array index out of range");
313template <
typename T,
size_t N>
322template <
typename T,
size_t N>
333template <
typename T,
size_t Size>
#define TETL_NO_UNIQUE_ADDRESS
Definition attributes.hpp:41
#define TETL_PRECONDITION_SAFE(...)
Definition check.hpp:17
constexpr auto move(InputIt first, InputIt last, OutputIt destination) -> OutputIt
Moves the elements in the range [first, last), to another range beginning at destination,...
Definition move.hpp:26
constexpr auto swap_ranges(ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2) -> ForwardIt2
Exchanges elements between range [first1 ,last1) and another range starting at first2.
Definition swap_ranges.hpp:24
constexpr auto lexicographical_compare(InputIt1 f1, InputIt1 l1, InputIt2 f2, InputIt2 l2, Compare comp) -> bool
Checks if the first range [f1, l1) is lexicographically less than the second range [f2,...
Definition lexicographical_compare.hpp:17
constexpr auto equal(InputIt1 first1, InputIt1 last1, InputIt2 first2, Predicate p) -> bool
Returns true if the range [first1, last1) is equal to the range [first2, first2 + (last1 - first1)),...
Definition equal.hpp:18
constexpr auto fill_n(OutputIt first, Size count, T const &value) -> OutputIt
Assigns the given value to the first count elements in the range beginning at first if count > 0....
Definition fill_n.hpp:16
ValueType[Size] c_array
Definition c_array.hpp:12
constexpr auto prev(BidirIt it, typename iterator_traits< BidirIt >::difference_type n=1) -> BidirIt
Return the nth predecessor of iterator it.
Definition prev.hpp:14
constexpr auto end(C &c) -> decltype(c.end())
Returns an iterator to the end (i.e. the element after the last element) of the given container c or ...
Definition end.hpp:14
constexpr auto begin(C &c) -> decltype(c.begin())
Returns an iterator to the beginning of the given container c or array array. These templates rely on...
Definition begin.hpp:20
Definition adjacent_find.hpp:8
typename conditional< B, T, F >::type conditional_t
Definition conditional.hpp:21
constexpr auto is_tuple_like
Definition is_tuple_like.hpp:9
etl::make_integer_sequence< etl::size_t, Size > make_index_sequence
Definition index_sequence.hpp:15
etl::integer_sequence< etl::size_t, Ints... > index_sequence
Definition index_sequence.hpp:12
constexpr auto is_etl_array
Definition array.hpp:331
TETL_BUILTIN_PTRDIFF ptrdiff_t
etl::ptrdiff_t is the signed integer type of the result of subtracting two pointers.
Definition ptrdiff_t.hpp:14
auto unreachable() -> void
Definition unreachable.hpp:10
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition size_t.hpp:14
constexpr bool is_nothrow_swappable_v
Definition is_nothrow_swappable.hpp:19
A container that encapsulates fixed size arrays.
Definition array.hpp:48
Type & reference
Definition array.hpp:54
Type const * const_iterator
Definition array.hpp:57
constexpr auto fill(const_reference value) -> void
Assigns the given value value to all elements in the container.
Definition array.hpp:207
constexpr auto to_array(T(&&a)[N])
Definition array.hpp:323
Type const * const_pointer
Definition array.hpp:53
constexpr auto front() const noexcept -> const_reference
Accesses the first item.
Definition array.hpp:87
Type * pointer
Definition array.hpp:52
constexpr auto get(array< T, Size > &&array) noexcept -> T &&
Definition array.hpp:295
constexpr auto crbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last ele...
Definition array.hpp:169
array(T, U...) -> array< T, 1+sizeof...(U)>
One deduction guide is provided for array to provide an equivalent of experimental::make_array for co...
constexpr auto rbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last ele...
Definition array.hpp:161
constexpr auto get(array< T, Size > const &&array) noexcept -> T const &&
Definition array.hpp:303
friend constexpr auto operator<(array const &lhs, array const &rhs) -> bool
Compares the contents of lhs and rhs lexicographically. The comparison is performed by a function equ...
Definition array.hpp:230
typename etl::reverse_iterator< const_iterator > const_reverse_iterator
Definition array.hpp:59
constexpr auto operator[](size_type const pos) noexcept -> reference
Accesses the specified item with range checking.
Definition array.hpp:62
constexpr auto operator[](size_type const pos) const noexcept -> const_reference
Accesses the specified item with range checking.
Definition array.hpp:73
constexpr auto back() noexcept -> reference
Accesses the last item.
Definition array.hpp:90
TETL_NO_UNIQUE_ADDRESS conditional_t< Size==0, empty_c_array, c_array< callback_t, Size+size_t{Size==0}> > _buf
Definition array.hpp:243
constexpr auto rend() noexcept -> reverse_iterator
Returns a reverse iterator to the element following the last element of the reversed array....
Definition array.hpp:175
constexpr auto get(array< T, Size > &array) noexcept -> T &
Extracts the Ith element element from the array. I must be an integer value in range [0,...
Definition array.hpp:279
constexpr auto begin() noexcept -> iterator
Returns an iterator to the beginning.
Definition array.hpp:108
Type * iterator
Definition array.hpp:56
constexpr auto end() noexcept -> iterator
Returns an iterator to the end.
Definition array.hpp:131
constexpr auto begin() const noexcept -> const_iterator
Returns an iterator to the beginning.
Definition array.hpp:118
constexpr auto cbegin() const noexcept -> const_iterator
Returns an const iterator to the beginning.
Definition array.hpp:128
size_t size_type
Definition array.hpp:50
friend constexpr auto operator==(array const &lhs, array const &rhs) -> bool
Checks if the contents of lhs and rhs are equal, that is, they have the same number of elements and e...
Definition array.hpp:223
constexpr auto empty() const noexcept -> bool
Checks if the container has no elements, i.e. whether begin() == end().
Definition array.hpp:193
constexpr auto data() noexcept -> pointer
Returns pointer to the underlying array serving as element storage. The pointer is such that range [d...
Definition array.hpp:99
constexpr auto back() const noexcept -> const_reference
Accesses the last item.
Definition array.hpp:93
constexpr auto front() noexcept -> reference
Accesses the first item.
Definition array.hpp:84
friend constexpr auto operator>(array const &lhs, array const &rhs) -> bool
Definition array.hpp:237
friend constexpr auto swap(array &lhs, array &rhs) noexcept(noexcept(lhs.swap(rhs))) -> void
Specializes the swap algorithm for array. Swaps the contents of lhs and rhs.
Definition array.hpp:218
constexpr auto to_array(T(&a)[N]) -> array< remove_cv_t< T >, N >
Creates a array from the one dimensional built-in array a. The elements of the array are copy-initial...
Definition array.hpp:314
constexpr auto get(array< T, Size > const &array) noexcept -> T const &
Definition array.hpp:287
constexpr auto max_size() const noexcept -> size_type
Returns the maximum number of elements the container is able to hold due to system or library impleme...
Definition array.hpp:204
constexpr auto end() const noexcept -> const_iterator
Returns an iterator to the end.
Definition array.hpp:141
Type const & const_reference
Definition array.hpp:55
constexpr auto crend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the element following the last element of the reversed array....
Definition array.hpp:190
friend constexpr auto operator>=(array const &lhs, array const &rhs) -> bool
Definition array.hpp:239
friend constexpr auto operator<=(array const &lhs, array const &rhs) -> bool
Definition array.hpp:235
constexpr auto swap(array &other) noexcept(is_nothrow_swappable_v< Type >) -> void
Exchanges the contents of the container with those of other. Does not cause iterators and references ...
Definition array.hpp:212
constexpr auto data() const noexcept -> const_pointer
Returns pointer to the underlying array serving as element storage. The pointer is such that range [d...
Definition array.hpp:105
constexpr auto rend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the element following the last element of the reversed array....
Definition array.hpp:181
typename etl::reverse_iterator< iterator > reverse_iterator
Definition array.hpp:58
ptrdiff_t difference_type
Definition array.hpp:51
constexpr auto size() const noexcept -> size_type
Returns the number of elements in the container, i.e. distance(begin(), end()).
Definition array.hpp:196
constexpr auto cend() const noexcept -> const_iterator
Returns an const iterator to the end.
Definition array.hpp:151
Type value_type
Definition array.hpp:49
constexpr auto rbegin() noexcept -> reverse_iterator
Returns a reverse iterator to the first element of the reversed array. It corresponds to the last ele...
Definition array.hpp:156
Definition c_array.hpp:15
Definition integral_constant.hpp:9
reverse_iterator is an iterator adaptor that reverses the direction of a given iterator....
Definition reverse_iterator.hpp:22
T type
Definition array.hpp:271
Provides compile-time indexed access to the type of the elements of the array using tuple-like interf...
Definition array.hpp:267
Definition tuple_size.hpp:15