Allow zero sized etl::array

This commit is contained in:
John Wellbelove 2025-05-18 16:02:02 +01:00
parent 66392ba8fe
commit ab11c39430

View File

@ -640,7 +640,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
reference at(size_t i)
reference at(size_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -653,7 +653,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
const_reference at(size_t i) const
const_reference at(size_t) const
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -667,7 +667,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR14
reference operator[](size_t i)
reference operator[](size_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -680,7 +680,7 @@ namespace etl
///\param i The index of the element to access.
//*************************************************************************
ETL_NODISCARD
ETL_CONSTEXPR const_reference operator[](size_t i) const
ETL_CONSTEXPR const_reference operator[](size_t) const
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -907,7 +907,7 @@ namespace etl
/// Fills the array with the specified value.
///\param value The value to fill the array with.
//*************************************************************************
ETL_CONSTEXPR14 void fill(parameter_t value)
ETL_CONSTEXPR14 void fill(parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
}
@ -916,9 +916,8 @@ namespace etl
/// Swaps the contents of this array and another.
///\param other A reference to the other array.
//*************************************************************************
ETL_CONSTEXPR14 void swap(array& other) ETL_NOEXCEPT
ETL_CONSTEXPR14 void swap(array&) ETL_NOEXCEPT
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
}
//*************************************************************************
@ -929,7 +928,7 @@ namespace etl
///\return An iterator to the first unassigned array element, or end().
//*************************************************************************
template <typename TIterator>
iterator assign(TIterator first, const TIterator last)
iterator assign(TIterator, const TIterator)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -944,7 +943,7 @@ namespace etl
///\return An iterator to the first array element set to 'value', or end().
//*************************************************************************
template <typename TIterator>
iterator assign(TIterator first, const TIterator last, parameter_t value)
iterator assign(TIterator, const TIterator, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -956,7 +955,7 @@ namespace etl
///\param position The index of the position to insert at.
///\param value The value to insert.
//*************************************************************************
inline iterator insert_at(size_t position, parameter_t value)
inline iterator insert_at(size_t, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -968,7 +967,7 @@ namespace etl
///\param position The iterator to the position to insert at.
///\param value The value to insert.
//*************************************************************************
iterator insert(const_iterator position, parameter_t value)
iterator insert(const_iterator, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -982,7 +981,7 @@ namespace etl
///\param last The iterator to one past the final item in the range.
//*************************************************************************
template <typename TIterator>
inline iterator insert_at(size_t position, TIterator first, const TIterator last)
inline iterator insert_at(size_t, TIterator, const TIterator)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -996,7 +995,7 @@ namespace etl
///\param last The iterator to one past the final item in the range.
//*************************************************************************
template <typename TIterator>
iterator insert(const_iterator position, TIterator first, const TIterator last)
iterator insert(const_iterator, TIterator, const TIterator)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1008,7 +1007,7 @@ namespace etl
/// After erase, the last value in the array will be unmodified.
///\param position The index of the position to erase at.
//*************************************************************************
inline iterator erase_at(size_t position)
inline iterator erase_at(size_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1020,7 +1019,7 @@ namespace etl
/// After erase, the last value in the array will be unmodified.
///\param position The iterator to the position to erase at.
//*************************************************************************
iterator erase(const_iterator position)
iterator erase(const_iterator)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1033,7 +1032,7 @@ namespace etl
///\param first The first item to erase.
///\param last The one past the last item to erase.
//*************************************************************************
iterator erase_range(size_t first, size_t last)
iterator erase_range(size_t, size_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1046,7 +1045,7 @@ namespace etl
///\param first The first item to erase.
///\param last The one past the last item to erase.
//*************************************************************************
iterator erase(const_iterator first, const_iterator last)
iterator erase(const_iterator, const_iterator)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1058,7 +1057,7 @@ namespace etl
///\param position The index of the position to erase at.
///\param value The value to use to overwrite the last element in the array.
//*************************************************************************
inline iterator erase_at(size_t position, parameter_t value)
inline iterator erase_at(size_t, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1070,7 +1069,7 @@ namespace etl
///\param position The iterator to the position to erase at.
///\param value The value to use to overwrite the last element in the array.
//*************************************************************************
iterator erase(const_iterator position, parameter_t value)
iterator erase(const_iterator, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1083,7 +1082,7 @@ namespace etl
///\param last The one past the last item to erase.
///\param value The value to use to overwrite the last elements in the array.
//*************************************************************************
iterator erase_range(size_t first, size_t last, parameter_t value)
iterator erase_range(size_t, size_t, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));
@ -1095,7 +1094,7 @@ namespace etl
///\param position The iterator to the position to erase at.
///\param value The value to use to overwrite the last elements in the array.
//*************************************************************************
iterator erase(const_iterator first, const_iterator last, parameter_t value)
iterator erase(const_iterator, const_iterator, parameter_t)
{
ETL_ASSERT_FAIL(ETL_ERROR(array_out_of_range));