Make etl::span::subspan functions compatible with C++11 constexpr

This commit is contained in:
John Wellbelove 2020-04-02 12:27:58 +01:00
parent 492d78b9b1
commit 788f8dbdb8
5 changed files with 11 additions and 13 deletions

View File

@ -232,9 +232,9 @@ namespace etl
}
//*************************************************************************
/// Assign from a view.
/// Assign from a span.
//*************************************************************************
ETL_CONSTEXPR14 span& operator =(const span& other) ETL_NOEXCEPT
ETL_CONSTEXPR span& operator =(const span& other) ETL_NOEXCEPT
{
mbegin = other.mbegin;
mend = other.mend;
@ -276,10 +276,7 @@ namespace etl
typename etl::enable_if<COUNT == etl::dynamic_extent, etl::span<element_type, ((EXTENT != etl::dynamic_extent) ? EXTENT - OFFSET : etl::dynamic_extent)> >::type
subspan() const
{
element_type* pb = mbegin + OFFSET;
element_type* pe = mend;
return etl::span<element_type, ((EXTENT != etl::dynamic_extent) ? EXTENT - OFFSET : etl::dynamic_extent)>(pb, pe);
return etl::span<element_type, ((EXTENT != etl::dynamic_extent) ? EXTENT - OFFSET : etl::dynamic_extent)>(mbegin + OFFSET, mend);
}
//*************************************************************************
@ -291,10 +288,7 @@ namespace etl
typename etl::enable_if<COUNT != etl::dynamic_extent, etl::span<element_type, COUNT> >::type
subspan() const
{
element_type* pb = mbegin + OFFSET;
element_type* pe = pb + COUNT;
return etl::span<element_type, COUNT>(pb, pe);
return etl::span<element_type, COUNT>(mbegin + OFFSET, mbegin + OFFSET + COUNT);
}
//*************************************************************************

View File

@ -39,7 +39,7 @@ SOFTWARE.
#define ETL_VERSION_MAJOR 17
#define ETL_VERSION_MINOR 4
#define ETL_VERSION_PATCH 1
#define ETL_VERSION_PATCH 2
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH)

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "17.4.1",
"version": "17.4.2",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library
version=17.4.1
version=17.4.2
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,7 @@
===============================================================================
17.4.2
Make etl::span::subspan functions compatible with C++11 constexpr
===============================================================================
17.4.1
Removed double definition of default case in switch.