Actually I need a data structure that helps me in reducing time for look-ups and retrieval of values of the respective keys.
Right now I am using a map container with key as structure and want to retrieve its values as fast as possible.
I am using gcc on fedora 12. I tried unordered map also, but it is not working with my compiler.
Also, Hash map is not available in namespace std.
If you’re using C++11, use
std::unordered_map, defined in<unordered_map>.Otherwise, use
std::tr1::unordered_map, defined in<tr1/unordered_map>, orboost::unordered_map, defined in<boost/unordered_map.hpp>.If your key is a user-defined type, then you’ll need to either define
hashandoperator==for the type, or provide suitable function types as template arguments tounordered_map.Of course, you should also measure the performance compared to
std::map; that may be faster in some circumstances.