ordered unordered_map

Discussion in 'C++' started by Ralf Goertz, Feb 2, 2010.

  1. Ralf Goertz

    Ralf Goertz Guest

    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
    Ralf Goertz, Feb 2, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paulo Matos

    Template problem with unordered_map

    Paulo Matos, Aug 3, 2006, in forum: C++
    Replies:
    4
    Views:
    442
    Paulo Matos
    Aug 3, 2006
  2. Rares Vernica

    error with tr1 unordered_map iterator

    Rares Vernica, Feb 24, 2007, in forum: C++
    Replies:
    6
    Views:
    1,789
  3. abir
    Replies:
    6
    Views:
    836
    W Karas
    Jun 26, 2008
  4. Ralf Goertz

    ordered unordered_map

    Ralf Goertz, Feb 2, 2010, in forum: C++
    Replies:
    5
    Views:
    1,721
    Ralf Goertz
    Feb 4, 2010
  5. DL

    Ordered list inside ordered list

    DL, Nov 9, 2009, in forum: Javascript
    Replies:
    6
    Views:
    307
    Dr J R Stockton
    Nov 21, 2009
Loading...

Share This Page