Jump to content
  • Advertisement
Sign in to follow this  
DesignerX

C++ Hash tables

This topic is 4852 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Some compilers (mingw off the top of my head) support __gnu_cxx::hash_table<> as an extension of the C++ Standard Library.


Right now it depends on your compiler. But I believe hash_map is going to be added to the C++ Standard Library once the C++ Standards Committee finalizes the next language draft.

Good luck.

Share this post


Link to post
Share on other sites
There is a non-standard std::hash_map or stdext::hash_map (depending on the compiler... yes, 'std' is improper here). There also is the upcoming std::tr1::unordered_map, for which you will have to wait.

Currently, the closest standard container would be a std::map, which offers O(log n) operations.

Share this post


Link to post
Share on other sites
You can use maps, just don't use something like std::map<std::string, mystruct> it's very slow. I use hash_map so I haven't tried it but I suppose you could just create a map using hash of your string as a key and use that to retrieve the result in a fast way. It's just not as convenient as using hash maps directly and you have to write your own hashing functions too. At this point I'd just bite the bullet and use a 3rd party hash_map.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!