Associative array

Imperatorn johan_forsberg_86 at hotmail.com
Fri Oct 13 11:32:29 UTC 2023


Hello there.

I'm wondering if anyone would be opposed to us/me making 
associative array having resize/reserve public?

Currently there exists private members in druntime etc for this 
but they are not exposed.

Basically I would like to be able to reserve n buckets before 
populating.

For reference, see std::unordered_map, which is kvp, which has 
rehashing etc:

```cpp
   template<typename _Key, typename _Tp,
	   typename _Hash = hash<_Key>,
	   typename _Pred = equal_to<_Key>,
	   typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
     class unordered_map
     {
       typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc>  
_Hashtable;
       _Hashtable _M_h;
```

https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/unordered_map.h

https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/hashtable.h



More information about the Digitalmars-d mailing list