felixguendling / cista

Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
https://cista.rocks
MIT License
1.84k stars 119 forks source link

Key assignment behavior in cista::raw::hash_map and cista::offset::hash_map #210

Closed freshFruict closed 7 months ago

freshFruict commented 7 months ago

It appears that when assigning one hash_map to another in both cista::raw::hash_map and cista::offset::hash_map, only keys that do not already exist in the destination hash_map are copied, while existing keys are ignored. So clear() must be called to replace them. This behavior seems unintended, but if it is intentional, it should be mentioned in the documentation. I'm using the latest version.

felixguendling commented 7 months ago

Can you please create a PR to fix this behavior?

Btw, if anyone is interested, here's another hash map we currently use (it's a wrapper that makes ankerl's unordered_dense hash map compatible to cista): https://github.com/motis-project/unordered_dense/blob/main/include/ankerl/cista_adapter.h

felixguendling commented 7 months ago

v0.15 is released with the fix and lot's of other new data structures, and small improvements.