public static Enumerator <T> GetEnumerator <T>(UnsafeSortedSet *set) where T : unmanaged { UDebug.Assert(set != null); UDebug.Assert(typeof(T).TypeHandle.Value == set->_typeHandle); return(new Enumerator <T>(set)); }
public static void CopyTo <T>(UnsafeSortedSet *set, void *destination, int destinationIndex) where T : unmanaged { if (destination == null) { throw new ArgumentNullException(nameof(destination)); } if (destinationIndex < 0) { throw new ArgumentOutOfRangeException(ThrowHelper.ArgumentOutOfRange_Index); } UDebug.Assert(set != null); UDebug.Assert(typeof(T).TypeHandle.Value == set->_typeHandle); var enumerator = GetEnumerator <T>(set); var dest = (T *)destination; int i = 0; while (enumerator.MoveNext()) { dest[destinationIndex + i] = enumerator.Current; i++; } }
public static void Add <T>(UnsafeSortedSet *set, T item) where T : unmanaged, IComparable <T> { UDebug.Assert(set != null); UDebug.Assert(typeof(T).TypeHandle.Value == set->_typeHandle); UnsafeOrderedCollection.Insert <T>(&set->_collection, item); }
public static bool Contains <T>(UnsafeSortedSet *set, T item) where T : unmanaged, IComparable <T> { UDebug.Assert(set != null); UDebug.Assert(typeof(T).TypeHandle.Value == set->_typeHandle); return(UnsafeOrderedCollection.Find <T>(&set->_collection, item) != null); }
public static void Free(UnsafeSortedSet *set) { if (set == null) { return; } if (set->_collection.Entries.Dynamic == 1) { UnsafeBuffer.Free(&set->_collection.Entries); } // clear memory *set = default; // free it Memory.Free(set); }
public Enumerator(UnsafeSortedSet *set) { _keyOffset = set->_collection.KeyOffset; _iterator = new UnsafeOrderedCollection.Enumerator(&set->_collection); }
public static void Clear(UnsafeSortedSet *set) { UDebug.Assert(set != null); UnsafeOrderedCollection.Clear(&set->_collection); }
public static bool IsFixedSize(UnsafeSortedSet *set) { UDebug.Assert(set != null); return(set->_collection.Entries.Dynamic == 0); }
public static int GetCapacity(UnsafeSortedSet *set) { UDebug.Assert(set != null); return(set->_collection.Entries.Length); }
public static int GetCount(UnsafeSortedSet *set) { UDebug.Assert(set != null); return(UnsafeOrderedCollection.GetCount(&set->_collection)); }
public NativeSortedSet(int capacity, bool fixedSize) { m_inner = UnsafeSortedSet.Allocate <T>(capacity, fixedSize); }
public NativeSortedSet(int capacity) { m_inner = UnsafeSortedSet.Allocate <T>(capacity, false); }