Full constexpr for etl::array

This commit is contained in:
John Wellbelove 2024-04-30 11:58:24 +01:00
parent 4b0f9a54fc
commit 4bc7853863

View File

@ -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());