C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

regarding the TR1 unordered set (and map)

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards
View previous topic :: View next topic  
Author Message
sharon.galtzur@gmail.com
Guest





PostPosted: Tue Feb 15, 2005 8:16 pm    Post subject: regarding the TR1 unordered set (and map) Reply with quote



Hello all,
In the TR1 unordered set proposal it seem there is no direct way for
the user to enforce max number of buckets.
I think this ability to control the max number of buckets (and
therefore control if there will be rehashing) is sometime desirable.

For example - if the hashing function generate for all keys a value in
finite range [0-R) then adding buckets will not work. In fact in this
case the hash table with trash all the time adding more and more
buckets while the buckets [R-bucket_count()) remain empty.
This will happen if the hash function has a mapping to a limited range
or if the keys are of limited range and the hash function does not
spread the keys enough.
In some cases this is ok - especially when the buckets have some
external meaning that is unknown from the container. (This is probably
also when the local_iterators are most useful).

I would suggest that max_load_factor(z) with z=0 will force no resize.

Another topic - some time it is useful to change the hashing function
on the fly. The reason is that the quality of the hash function
depends heavily on the keys. It is hard to create a good hash function
for every circumstance. While it is possible to simply generate a new
hash table it is probably better to allow rehashing with a new hashing
function.


What do you think?

Sharon

---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language, library and standards All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.