-
June 11th, 2008, 01:02 PM
#1
[RESOLVED] hash_map in Visual Studio 2005
Hi all,
I haven't used hash_map too much, usually map works good enough for me, but for my current task hash_map seems to be more preferable container.
I was confused when I read that Microsoft hash_map requires keys to be less than comparable, whereas other sources say that a Binary Predicate used for comparing keys must be an equivalence relation. I'm aware that hash_map is not a really "standart" template, but wonder if I need to implement both opeator == and operator < for possible compartible issues, or using Strict Weak Ordering for hash_map is pretty common.
Thanks in advance.
-
June 11th, 2008, 05:51 PM
#2
Re: hash_map in Visual Studio 2005
-
June 11th, 2008, 05:55 PM
#3
Re: hash_map in Visual Studio 2005
Why not just use hash_compare. Have you had a look at the examples?
Succinct is verbose for terse
-
June 11th, 2008, 06:30 PM
#4
Re: hash_map in Visual Studio 2005
My question is how "common" Microsoft implementation of hash_map is. It seems for me that they keep keys with the same hash values sorted, that is not necessary.
hash_compare is good for Visual Studio, but it doesn't seem to be standart.
For example, Microsoft hash_map implementation indroduces hash_map::key_compare, whereas others introduce hash_map::key_equal.
E.g. : http://www.sgi.com/tech/stl/HashedAs...Container.html
As a result, my code which uses a custom class as a key in hash_map and relies on MS implementation might not be compilled.
Last edited by a1ex07; June 11th, 2008 at 06:33 PM.
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
|