I am a big java fan but i have to work now on C++ for a project. I intended to you a java hashmap kind of feature in c++. After googling i found there exists no hashmap/hashtable in C++ STL library. But i found these data types: map, unordered_map, unorderd_set and hash_map. hash_map is microsoft’s specific dll/library and remaining are used under STL. i have to work on IBM XL C/C++ compiler. So i can’t use microsoft/boost as my company don’t recommend them. All i have to use STL specific. Please, provide some info on these collections. What would be best among these STL specifics if i have to choose hashmap functionality? Thanks in advance.
Share
Did you read Wikipedia’s page on associative containers in C++?
If you want real hash table (with a key providing an hash code, but no order between keys) you could use C++ 2011 std::unordered_map template. You’ll need a compiler recent enough to be C++11 compatible in that regard.
If you can provide an order on keys, consider also using std::map which is available even in the older C++03 standard.