diff --git a/substrate/span b/substrate/span index 15a045e9..a1097819 100644 --- a/substrate/span +++ b/substrate/span @@ -92,20 +92,25 @@ namespace substrate template struct span { + static constexpr bool matches_extent = extent_v == dynamic_extent; + + template + using count_is_dynamic_extent = substrate::bool_constant; + template static constexpr - substrate::enable_if_t + substrate::enable_if_t(), size_t> _subspanExtent() noexcept { return count; } template static constexpr - substrate::enable_if_t + substrate::enable_if_t(), size_t> _subspanExtent() noexcept { return extent_v - offset; } template static constexpr - substrate::enable_if_t + substrate::enable_if_t(), size_t> _subspanExtent() noexcept { return dynamic_extent; } template using isCompatArray_t = internal::and_t, internal::isArrayConvertible>; + matches_extent || extent_v == N>, internal::isArrayConvertible>; template constexpr static bool isCompatArray () { return isCompatArray_t::value; } @@ -239,7 +244,7 @@ namespace substrate } template constexpr auto subspan() const noexcept -> - substrate::enable_if_t(), span()>> { static_assert(offset <= size(), "offset must be less than or equal to the size of the span"); @@ -250,7 +255,7 @@ namespace substrate template constexpr auto subspan() const noexcept -> - substrate::enable_if_t(), span()>> { static_assert(offset <= extent, "offset must be less than or equal to the extent of the span"); @@ -259,7 +264,7 @@ namespace substrate } template constexpr auto subspan() const noexcept -> - substrate::enable_if_t(), span()>> { static_assert(offset <= size(), "offset must be less than or equal to the size of the span"); @@ -270,7 +275,7 @@ namespace substrate template constexpr auto subspan() const noexcept -> - substrate::enable_if_t(), span()>> { static_assert(offset <= extent, "offset must be less than or equal to the extent of the span");