[libc++] _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY for hashtable-based containers? #102303
Open
Description
Hi, in a project that I work on I see a lot of code that implicitly depends on order of elements in hashtable-based containers (unordered_set/map/multimap).
What if we shake order of elements in hashtable based on compile define like _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY which is shaking sorting inputs now?
Maybe we can wrap hash function if such compile definition is used, and combine original hash with random (but fixed at process start) seed to produce different results, which will in turn produce different order of elements in hashtable.
I expect that can help us to find places that have bad dependency on element order.
Is this a good idea? Anyone else finds this potentially useful?