Added function to convert StrideSpan to regular span, if possible.
This commit is contained in:
parent
8ce77cf8bf
commit
bb4d31747a
@ -119,6 +119,7 @@ public:
|
|||||||
|
|
||||||
constexpr operator bool() const noexcept { return !empty(); }
|
constexpr operator bool() const noexcept { return !empty(); }
|
||||||
constexpr bool operator!() const noexcept { return empty(); }
|
constexpr bool operator!() const noexcept { return empty(); }
|
||||||
|
explicit operator std::span<T>() const noexcept;
|
||||||
|
|
||||||
reference operator[](size_type index);
|
reference operator[](size_type index);
|
||||||
const_reference operator[](size_type index) const;
|
const_reference operator[](size_type index) const;
|
||||||
@ -138,6 +139,13 @@ public:
|
|||||||
// public functions
|
// public functions
|
||||||
//
|
//
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
StrideSpan<T>::operator std::span<T>() 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<typename T>
|
template<typename T>
|
||||||
StrideSpanIterator<T>& StrideSpanIterator<T>::operator+=(difference_type diff)
|
StrideSpanIterator<T>& StrideSpanIterator<T>::operator+=(difference_type diff)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user