CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2007
    Location
    Richmond, BC
    Posts
    79

    [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.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: hash_map in Visual Studio 2005

    What is your question?

  3. #3
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,019

    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

  4. #4
    Join Date
    Jul 2007
    Location
    Richmond, BC
    Posts
    79

    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
  •  





Click Here to Expand Forum to Full Width

Featured