Skip to content

Commit

Permalink
Fix span fixed extent empty (#1007)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolandreichweinbmw authored Jan 4, 2025
1 parent 99d7537 commit adeb902
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/etl/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR bool empty() const ETL_NOEXCEPT
{
return false;
return Extent == 0;
}

//*************************************************************************
Expand Down
4 changes: 4 additions & 0 deletions test/test_span_fixed_extent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down Expand Up @@ -464,6 +465,9 @@ namespace
{
View view1(etldata.begin(), etldata.begin());
CHECK(!view1.empty());

EView view2(etldata.begin(), etldata.begin());
CHECK(view2.empty());
}

//*************************************************************************
Expand Down

0 comments on commit adeb902

Please sign in to comment.