At various places, I’ve read that STL does not provide hashtable and union data structures. How could these be implemented using other existing STL data structures?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try the std::tr1::unordered_map for your hash map. std::map is ordered, so it’s not really as efficient as hash. Not sure what you mean by a union data structure, but you can have unioned structs in C++
EDIT: Additionally there are many other implementations of hash maps that some have done. Boost has an unordered map, Prasoon mentioned one in the question comments, and Google has sparsehash.