From d794e84c547f2486289d9900f6db04c7beddd673 Mon Sep 17 00:00:00 2001 From: mike919192 <91038685+mike919192@users.noreply.github.com> Date: Tue, 25 Mar 2025 14:16:44 -0400 Subject: [PATCH] Potential fix for span construct (#1051) * Try fix for span constructors * Make base class public --- include/etl/span.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/etl/span.h b/include/etl/span.h index 8d03e5fb..a313b54b 100644 --- a/include/etl/span.h +++ b/include/etl/span.h @@ -55,11 +55,13 @@ SOFTWARE. namespace etl { + //empty base optimization means this has zero size + class span_base {}; //*************************************************************************** /// Span - Fixed Extent //*************************************************************************** template - class span + class span : public span_base { public: @@ -113,7 +115,8 @@ namespace etl /// Construct from a container or other type that supports /// data() and size() member functions. //************************************************************************* - template >::value && + template >::value && + !etl::is_pointer>::value && !etl::is_array>::value&& etl::is_same, etl::remove_cv_t::value_type>>::value, void>::type> ETL_CONSTEXPR span(TContainer&& a) ETL_NOEXCEPT @@ -158,7 +161,7 @@ namespace etl /// Copy constructor //************************************************************************* template - ETL_CONSTEXPR span(const etl::span& other, typename etl::enable_if<(Extent == etl::dynamic_extent) || (N == etl::dynamic_extent) || (N == Extent), void>::type) ETL_NOEXCEPT + ETL_CONSTEXPR span(const etl::span& other, typename etl::enable_if<(Extent == etl::dynamic_extent) || (N == etl::dynamic_extent) || (N == Extent), void>::type* = 0) ETL_NOEXCEPT : pbegin(other.data()) { } @@ -511,7 +514,8 @@ namespace etl /// Construct from a container or other type that supports /// data() and size() member functions. //************************************************************************* - template >::value && + template >::value && + !etl::is_pointer>::value && !etl::is_array>::value && etl::is_same, etl::remove_cv_t::value_type>>::value, void>::type> ETL_CONSTEXPR span(TContainer&& a) ETL_NOEXCEPT