[libcxx-commits] [libcxx] [libc++] Add randomize unspecified stability in `__hash_table` (PR #105982)
Ibraim Ganiev via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Sep 2 11:28:39 PDT 2024
olologin wrote:
Sorry, just want to clarify:
>`std::unordered_{multiset,multimap}`, equal ranges are shuffled and order within equal ranges are shuffled.
lets say that container contains this list: `(1, 'a'), (1, 'a'), (2, 'b'), (3, 'c')`, does this mean that we can iterate over it in the following order: `(1, 'a'), (2, 'b'), (3, 'c'), (1, 'a')` (if we are lucky enough)?
I don't completely understand your implementation, but it looks clever 👍 .
My original idea was much simpler, but with drawbacks: We could take some seed (maybe user-defined from environment variable), and just `combine` it together with result of user-supplied hash function. But the drawback is that you have to make that seed constant for whole process lifetime, otherwise you will not be able to pass around hash table between your dlls (hashes would differ). And now when I write this I understand that I would still not be able to pass hashtable to libraries built without `_LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY`
https://github.com/llvm/llvm-project/pull/105982
More information about the libcxx-commits
mailing list