feat(collections): add implicit conversions and AddRange overloads

Added implicit conversion operators to UnsafeArray<T> and UnsafeList<T> for easier conversion to ReadOnlyUnsafeCollection<T> and Span<T>. Introduced new AddRange overloads in UnsafeList<T> for ReadOnlyUnsafeCollection<T> and pointer-based sources. Updated AssemblyVersion in all projects. Improved MemoryLeakException stack trace output and fixed a documentation comment.
This commit is contained in:
2026-03-25 17:37:21 +09:00
parent 69b054e81d
commit a32b0668de
6 changed files with 57 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace Misaki.HighPerformance.LowLevel.Collections;
@@ -319,4 +320,14 @@ public unsafe struct UnsafeArray<T> : IUnsafeCollection<T>
_buffer = null;
_count = 0;
}
public static implicit operator ReadOnlyUnsafeCollection<T>(UnsafeArray<T> array)
{
return array.AsReadOnly();
}
public static implicit operator Span<T>(UnsafeArray<T> array)
{
return array.AsSpan();
}
}