using System.Runtime.InteropServices; namespace Brutal.ImGuiApi; static class InteropExtensions { /// Whether this span is unset rather than empty. /// Technically "IsDefault", but "IsNull" seems more intuitive. public static unsafe bool IsNull(in this ReadOnlySpan span) where T : unmanaged { ref var spanRef = ref MemoryMarshal.GetReference(span); fixed (T* spanPtr = &spanRef) return spanPtr == null; } /// public static unsafe bool IsNull(in this Span span) where T : unmanaged { ref var spanRef = ref MemoryMarshal.GetReference(span); fixed (T* spanPtr = &spanRef) return spanPtr == null; } }