Add ToSpan from 24c03c0e4b

This commit is contained in:
Wojtek Figat
2023-07-18 10:54:21 +02:00
parent fdb06424d4
commit 0f613abfb9

View File

@@ -115,6 +115,12 @@ inline Span<T> ToSpan(const T* ptr, int32 length)
return Span<T>(ptr, length);
}
template<typename T, typename U = T, typename AllocationType = HeapAllocation>
inline Span<U> ToSpan(const Array<T, AllocationType>& data)
{
return Span<U>((U*)data.Get(), data.Count());
}
template<typename T>
inline bool SpanContains(const Span<T> span, const T& value)
{