public static void Create <TKeyPool, TValuePool, TTablePool>(TKeyPool keyPool, TValuePool valuePool, TTablePool tablePool, int initialElementPoolIndex, int tableSizePower,
                                                              out QuickDictionary <TKey, TValue, TKeySpan, TValueSpan, TTableSpan, TEqualityComparer> dictionary)
     where TKeyPool : IMemoryPool <TKey, TKeySpan>
     where TValuePool : IMemoryPool <TValue, TValueSpan>
     where TTablePool : IMemoryPool <int, TTableSpan>
 {
     Create(keyPool, valuePool, tablePool, initialElementPoolIndex, tableSizePower, default(TEqualityComparer), out dictionary);
 }
Beispiel #2
0
 public QuickDictionary(int initialCapacity, int tableSizePower, IUnmanagedMemoryPool pool, TEqualityComparer comparer)
 {
     pool.TakeAtLeast <TKey>(initialCapacity, out var keySpan);
     pool.TakeAtLeast <TValue>(keySpan.Length, out var valueSpan);
     pool.TakeAtLeast <int>(keySpan.Length << tableSizePower, out var tableSpan);
     //No guarantee that the table is clean; clear it.
     tableSpan.Clear(0, tableSpan.Length);
     this = new QuickDictionary <TKey, TValue, TEqualityComparer>(ref keySpan, ref valueSpan, ref tableSpan, comparer, tableSizePower);
 }
 public static void Create <TKeyPool, TValuePool, TTablePool>(TKeyPool keyPool, TValuePool valuePool, TTablePool tablePool, int initialElementPoolIndex, int tableSizePower, TEqualityComparer comparer,
                                                              out QuickDictionary <TKey, TValue, TKeySpan, TValueSpan, TTableSpan, TEqualityComparer> dictionary)
     where TKeyPool : IMemoryPool <TKey, TKeySpan>
     where TValuePool : IMemoryPool <TValue, TValueSpan>
     where TTablePool : IMemoryPool <int, TTableSpan>
 {
     keyPool.TakeForPower(initialElementPoolIndex, out var keySpan);
     valuePool.TakeForPower(initialElementPoolIndex, out var valueSpan);
     tablePool.TakeForPower(initialElementPoolIndex + tableSizePower, out var tableSpan);
     //No guarantee that the table is clean; clear it.
     tableSpan.Clear(0, tableSpan.Length);
     dictionary = new QuickDictionary <TKey, TValue, TKeySpan, TValueSpan, TTableSpan, TEqualityComparer>(ref keySpan, ref valueSpan, ref tableSpan, comparer);
 }