What about a hashmap in irr::core?

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Massengrab
Posts: 3
Joined: Fri Aug 11, 2006 1:22 am

What about a hashmap in irr::core?

Post by Massengrab »

Hi!

I always missed something like a hash in the irrlicht library. So i propose to add the following:

An interface with the method

Code: Select all

u32 getHash()
which has to be overwritten by eash class which should be able to be put in the hash.


As Hash itself i'd suggest to use a avl-tree with the hash as key.


Moreover i would add this method to some of the other standard classes like string.

What do you think about it? If you support the idea i could post a reference implementation in about one day
elander
Posts: 193
Joined: Tue Oct 05, 2004 11:37 am

Post by elander »

It's easier if you just study these that are already made in a pro way and add whatever you want:

http://www.cs.fiu.edu/~weiss/dsaa_c++3/code/
http://www.cs.fiu.edu/~weiss/#dsaac++3

No need to reinvent what is already invented.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

http://www.open-std.org/jtc1/sc22/wg21/ ... n1456.html

Several C++ standard library implementations provide std::hash_map and std::hash_set. There is also std::tr1::unordered_set and std::tr1::unordered_map that are offered by the more up-to-date environments. The interfaces are very similar. I believe that the boost library has unordered_set and unordered_map implementations.
Massengrab
Posts: 3
Joined: Fri Aug 11, 2006 1:22 am

Post by Massengrab »

i know that there are tons of implementations but irrlicht also uses irr::core::array instead of std::vector, irr::core::string instead of std::string, etc. so i thought it would be useful to have a libpng-licensed hash class in the irrlicht core lib, too
Post Reply