4#include <system/span.h>
5#include <system/memory.h>
7namespace System {
namespace Runtime {
namespace InteropServices {
23 return Span<uint8_t>(span.data_ptr(), span.get_Length() *
sizeof(T));
31 template <
typename TFrom,
typename TTo>
34 return Span<TTo>((TTo*)span.data_ptr(), span.get_Length() *
sizeof(TFrom) /
sizeof(TTo));
44 return reinterpret_cast<const Memory<T>&
>(memory);
54 return *span.data_ptr();
64 return *span.data_ptr();
Represents a mutable memory segment backed by an array.
Definition: memory.h:154
Represents a read-only memory segment backed by an array.
Definition: memory.h:232
Forward to use within Span class.
Definition: span.h:404
Provides memory marshalling implementation. For compatibility with translated code only,...
Definition: memory_marshal.h:14
static Span< TTo > Cast(const Span< TFrom > &span)
Casts a Span of one primitive type TFrom to another primitive type TTo.
Definition: memory_marshal.h:32
static T & GetReference(const ReadOnlySpan< T > &span)
Gets a reference to the first element of the specified read-only span.
Definition: memory_marshal.h:62
static Span< uint8_t > AsBytes(const Span< T > &span)
Casts a Span of one primitive type T to Span of bytes.
Definition: memory_marshal.h:21
static Memory< T > AsMemory(const ReadOnlyMemory< T > &memory)
Casts a ReadOnlyMemory to mutable Memory.
Definition: memory_marshal.h:42
static T & GetReference(const Span< T > &span)
Gets a reference to the first element of the specified span.
Definition: memory_marshal.h:52
Represents a contiguous region of arbitrary memory similar to C++20's std::span.
Definition: span.h:364
Definition: db_command.h:9