public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy) { _valuesInfo = new FasterDictionaryNode <TKey> [size]; _values = allocationStrategy; _values.Alloc(size); DBC.Common.Check.Ensure(_values.capacity == _valuesInfo.Length, "invalid buffer size"); _buckets = new int[HashHelpers.GetPrime((int)size)]; }
public SveltoDictionary(uint size, IBufferStrategy <TValue> allocationStrategy) { //AllocationStrategy must be passed external for TValue because SveltoDictionary doesn't have struct //constraint needed for the NativeVersion if (UnmanagedTypeExtensions.IsUnmanaged <TKey>() == false || UnmanagedTypeExtensions.IsUnmanaged <TValue>() == false) { _valuesInfo = new ManagedStrategy <FasterDictionaryNode <TKey> >(size); } else { _valuesInfo = new NativeStrategy <FasterDictionaryNode <TKey> >(size); } _buckets = new int[HashHelpers.GetPrime((int)size)]; _values = allocationStrategy; _values.Alloc(size); }