diff --git a/include/etl/span.h b/include/etl/span.h index 18e672f4b..a0004c418 100644 --- a/include/etl/span.h +++ b/include/etl/span.h @@ -45,6 +45,10 @@ SOFTWARE. #include "private/dynamic_extent.h" +#if ETL_USING_CPP20 && ETL_USING_STL + #include +#endif + ///\defgroup span span ///\ingroup containers @@ -357,6 +361,16 @@ namespace etl : etl::span(pbegin + offset, pbegin + offset + count); } +#if ETL_USING_CPP20 && ETL_USING_STL + //************************************************************************* + /// Conversion operator to std::span + //************************************************************************* + ETL_NODISCARD ETL_CONSTEXPR operator etl::span() + { + return std::span(pbegin, Extent); + } +#endif + private: pointer pbegin; @@ -366,7 +380,7 @@ namespace etl /// Span - Dynamic Extent //*************************************************************************** template - class span + class span { public: @@ -679,6 +693,16 @@ namespace etl : etl::span(pbegin + offset, pbegin + offset + count); } +#if ETL_USING_CPP20 && ETL_USING_STL + //************************************************************************* + /// Conversion operator to std::span + //************************************************************************* + ETL_NODISCARD ETL_CONSTEXPR operator etl::span() + { + return std::span(pbegin, etl::dynamic_extent); + } +#endif + private: pointer pbegin;