What is the typical layout of std::unordered_map<K, V> ? Are the objects K and V stored in the buckets themselves, or do the buckets store pointers on nodes containing keys and values?
I am trying to understand the consequences of using std::unordered_map<K, V> compared to std::unordered_map<K, V*> . Assuming Iβm only ever going to look at values, is there any reason to prefer the latter, even if the values ββare quite large? The only reason I can imagine is that the values ββare stored in a row in buckets and should be redistributed every time you look at the container again.
Is there anything in the standard to ensure that this does not happen?
source share