diff --git a/source/mijin/container/stride_span.hpp b/source/mijin/container/stride_span.hpp index 87770ca..6ee5435 100644 --- a/source/mijin/container/stride_span.hpp +++ b/source/mijin/container/stride_span.hpp @@ -119,6 +119,7 @@ public: constexpr operator bool() const noexcept { return !empty(); } constexpr bool operator!() const noexcept { return empty(); } + explicit operator std::span() const noexcept; reference operator[](size_type index); const_reference operator[](size_type index) const; @@ -138,6 +139,13 @@ public: // public functions // +template +StrideSpan::operator std::span() const noexcept +{ + MIJIN_ASSERT(strideBytes_ == sizeof(T), "Can't convert to regular span if stride isn't exactly size of type."); + return {&*begin_, &*end_}; +} + template StrideSpanIterator& StrideSpanIterator::operator+=(difference_type diff) {