From 4bc785386320112b50339dbc4eb6e82b267f2856 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 30 Apr 2024 11:58:24 +0100 Subject: [PATCH] Full constexpr for etl::array --- include/etl/array.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/etl/array.h b/include/etl/array.h index caca9e7e..0a41faed 100644 --- a/include/etl/array.h +++ b/include/etl/array.h @@ -115,6 +115,7 @@ namespace etl ///\param i The index of the element to access. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 reference at(size_t i) { ETL_ASSERT(i < SIZE, ETL_ERROR(array_out_of_range)); @@ -141,6 +142,7 @@ namespace etl ///\param i The index of the element to access. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 reference operator[](size_t i) { return _buffer[i]; @@ -161,6 +163,7 @@ namespace etl /// Returns a reference to the first element. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 reference front() { return _buffer[0]; @@ -179,6 +182,7 @@ namespace etl /// Returns a reference to the last element. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 reference back() { return _buffer[SIZE - 1]; @@ -197,6 +201,7 @@ namespace etl /// Returns a pointer to the first element of the internal buffer. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 pointer data() ETL_NOEXCEPT { return &_buffer[0]; @@ -219,6 +224,7 @@ namespace etl /// Returns an iterator to the beginning of the array. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 iterator begin() ETL_NOEXCEPT { return &_buffer[0]; @@ -246,6 +252,7 @@ namespace etl /// Returns an iterator to the end of the array. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 iterator end() ETL_NOEXCEPT { return _buffer + SIZE; @@ -273,6 +280,7 @@ namespace etl // Returns an reverse iterator to the reverse beginning of the array. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 reverse_iterator rbegin() ETL_NOEXCEPT { return reverse_iterator(end()); @@ -300,6 +308,7 @@ namespace etl /// Returns a reverse iterator to the end of the array. //************************************************************************* ETL_NODISCARD + ETL_CONSTEXPR14 reverse_iterator rend() ETL_NOEXCEPT { return reverse_iterator(begin());