Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fixed extent span empty() #1007

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading