|
-
February 16th, 2011, 02:20 PM
#1
[RESOLVED] several STL containers questions
1. should I use hash_map, hash_set, hash_... instead of the normal map, set, multimap, etc. ? Are the hash versions supercede versions of the normal ones? Or there are times when I should use e.g. a map instead of a hash map?
2. are there occasions when I must write a hash function? If yes, how do I do that and how do I make a good (i.e. not a stupid) hash function?
3. I've read about these member functions, but I don't understand when or why I should use them: equal_range, lower_bound, upper_bound. well, about lower & upper bounds, I understand that they usually find something if that particular key does not exist - is there more to them?
4. what are the uses of emplace? for the associative containers, for instance, why shouldn't I simply insert a pair?
5.what function should I use to find an element of an associative container? at, find, lower_bound, or what?? is there some difference in speed among them?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|