Fix span fixed extent empty (#1007)

This commit is contained in:
rolandreichweinbmw 2025-01-04 14:33:05 +01:00 committed by GitHub
parent 99d7537506
commit adeb902241
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View File

@ -238,7 +238,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
{
return false;
return Extent == 0;
}
//*************************************************************************

View File

@ -52,6 +52,7 @@ namespace
typedef etl::span<int, 10U> View;
typedef etl::span<int, 9U> SView;
typedef etl::span<const int, 10U> CView;
typedef etl::span<int, 0U> EView;
#if ETL_USING_CPP20
using StdView = std::span<int, 10U>;
@ -464,6 +465,9 @@ namespace
{
View view1(etldata.begin(), etldata.begin());
CHECK(!view1.empty());
EView view2(etldata.begin(), etldata.begin());
CHECK(view2.empty());
}
//*************************************************************************