R
Ralf Goertz
Hi,
I recently found out that using unordered_map<unsigned, Foo> instead of
map<unsigned, Foo> speeds up my program substantially (it contains
several hundreds of thousands elements). However, I really would like to
be able to iterate over those elements in an ordered way at the end of
the program. Is there a way to do that? If m would be that unordered map
what about m.rehash(n) where n=m.size()? According to Pete Pecker's book
that would "resize the container so that it has at least n buckets…".
And aren't the keys for integral types hashed by putting them into
residue classes mod bucket count? If so, m would be ordered, right?
Ralf
I recently found out that using unordered_map<unsigned, Foo> instead of
map<unsigned, Foo> speeds up my program substantially (it contains
several hundreds of thousands elements). However, I really would like to
be able to iterate over those elements in an ordered way at the end of
the program. Is there a way to do that? If m would be that unordered map
what about m.rehash(n) where n=m.size()? According to Pete Pecker's book
that would "resize the container so that it has at least n buckets…".
And aren't the keys for integral types hashed by putting them into
residue classes mod bucket count? If so, m would be ordered, right?
Ralf