Include hash_map
Posted: Sat Mar 12, 2005 5:05 pm
I believe hash_map should be included.
It would only require including two additional header files. No additional libraries would be required. Any compiler that supports STL will support hash_map. Those two header files could be distributed with source distro and included like the other header file are.
Implementing it would require minimal changes. It works in a very similar way to a regular map:
SomeMap[serial] = SomeObject
SomeHashMap[serial] = SomeObject
In fact, replacing a map with a hash_map would only require replacing the line of code where the map is created.
The only down-side to using a hash_map instead of a regular map is that order is not preserved, but that wouldn’t matter in this case anyway.
The speed increase would be dramatic, since lookups of objects are done an incredible number of times in any given second.
Therefore, I think it is worth it.
It would only require including two additional header files. No additional libraries would be required. Any compiler that supports STL will support hash_map. Those two header files could be distributed with source distro and included like the other header file are.
Implementing it would require minimal changes. It works in a very similar way to a regular map:
SomeMap[serial] = SomeObject
SomeHashMap[serial] = SomeObject
In fact, replacing a map with a hash_map would only require replacing the line of code where the map is created.
The only down-side to using a hash_map instead of a regular map is that order is not preserved, but that wouldn’t matter in this case anyway.
The speed increase would be dramatic, since lookups of objects are done an incredible number of times in any given second.
Therefore, I think it is worth it.