Add Serialization for khash map
I've tested this on a map with 4096 keys, and kh_exist, kh_key, and kh_val all agreed between original and loaded maps. This only works, however, with maps, not sets.
I've updated this to work for sets as well as maps.
It looks like this is writing bits to a file in a specific order, not "stringifying" the khash contents. (In case anyone else was wondering.)
Also, why write to a filepath instead of a caller-supplied buffer?
That's a reasonable point. I think having separate write (for writing to a buffer) and serialize methods (for writing to a file) where the latter calls the former is probably best. This also does not work for string sets or maps, but external storage complicates things.
I've updated this. kh_read_##name and kh_write_##name both work on FILE *s, while kh_serialize_##name and kh_deserialize_##name operate on paths.