On Tuesday, 4 April 2017 at 09:37:12 UTC, biocyberman wrote:
On Tuesday, 4 April 2017 at 05:29:42 UTC, Ali Çehreli wrote:
Covert has a very different meaning. :)
Ali
Thanks Ali. My fingers argued they are the same :) And I can't
find a way to edit my post after posting.
I would love to have your input. I am revisited your book
several times to read relevant sections. But these complex
macros are still holding me back.
Most of those macros are not needed and can be just part the
struct definition:
i.e. you want something like
struct kh_hashtable(K,V,bool _is_map, alias hash_func, alias
hash_eq = (K a, K b)=> a == b) {
khint_t n_buckets, size, n_occupied, upper_bound;
khint32_t *flags;
K *keys;
V *vals;
//No need for __KHASH_PROTOTYPES / __KHASH_IMPL just declare
the function as methods of the struct
this() { ... } // in place of kh_init_##name
~this() { ... } // for destroy
resize(khint_t new_size){ ... } //kh_resize_##name
// and so on for each method in __KHASH_IMPL
}