We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Just tried this and seems to not allocate in Unity. Something more generic like IReadOnlyCollection can't be used as it allocates.
public static RefLinqEnumerable<T, HashSetEnumerator<T>> ToRefLinq<T>(this HashSet<T> c) => new(new(c)); public struct HashSetEnumerator<T> : IRefEnumerable<T> { private T curr; private HashSet<T>.Enumerator ie; public HashSetEnumerator(HashSet<T> list) { ie = list.GetEnumerator(); curr = default; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool MoveNext() { bool end = ie.MoveNext(); curr = ie.Current; if(!end) ie.Dispose(); return end; } public T Current => curr; }
No idea if that Dispose is correct.
The text was updated successfully, but these errors were encountered:
Nice! Would you mind making a PR or at least a patch?
Sorry, something went wrong.
No branches or pull requests
Just tried this and seems to not allocate in Unity. Something more generic like IReadOnlyCollection can't be used as it allocates.
No idea if that Dispose is correct.
The text was updated successfully, but these errors were encountered: