public static void Create <TPool, TTablePool>(TPool pool, TTablePool tablePool, int initialElementPoolIndex, int tableSizePower, out QuickSet <T, TSpan, TTableSpan, TEqualityComparer> set) where TPool : IMemoryPool <T, TSpan> where TTablePool : IMemoryPool <int, TTableSpan> { Create(pool, tablePool, initialElementPoolIndex, tableSizePower, default(TEqualityComparer), out set); }
public QuickSet(int initialCapacity, int tableSizePower, IUnmanagedMemoryPool pool, TEqualityComparer comparer) { pool.TakeAtLeast <T>(initialCapacity, out var span); pool.TakeAtLeast <int>(span.Length << tableSizePower, out var tableSpan); //No guarantee that the table is clean; clear it. tableSpan.Clear(0, tableSpan.Length); this = new QuickSet <T, TEqualityComparer>(ref span, ref tableSpan, comparer, tableSizePower); }
public static void Create <TPool, TTablePool>(TPool pool, TTablePool tablePool, int initialElementPoolIndex, int tableSizePower, TEqualityComparer comparer, out QuickSet <T, TSpan, TTableSpan, TEqualityComparer> set) where TPool : IMemoryPool <T, TSpan> where TTablePool : IMemoryPool <int, TTableSpan> { pool.TakeForPower(initialElementPoolIndex, out var span); tablePool.TakeForPower(initialElementPoolIndex + tableSizePower, out var tableSpan); //No guarantee that the table is clean; clear it. tableSpan.Clear(0, tableSpan.Length); set = new QuickSet <T, TSpan, TTableSpan, TEqualityComparer>(ref span, ref tableSpan, comparer, tableSizePower); }