mdw233
asked on
Hashtable equivalent in MFC C++
Hi All,
I am looking for a fast data structure in c++. I am currently storing data in a vector<CString> however any time I need to find a value I must traverse the entire vector until I find the specific value I am looking for. In C# I am able to use a Hashtable to access the specific element I am looking for instantly, without traversing. Does something like this exist in c++. I have been playing around with stdext::hash_map<> but am not sure if it is my best option. Not sure that it isn't either, but I am sort of a novice when it comes to c++ so I wanted to see if there was a better option.
As always, thanks in advance for any help!
-Matt
I am looking for a fast data structure in c++. I am currently storing data in a vector<CString> however any time I need to find a value I must traverse the entire vector until I find the specific value I am looking for. In C# I am able to use a Hashtable to access the specific element I am looking for instantly, without traversing. Does something like this exist in c++. I have been playing around with stdext::hash_map<> but am not sure if it is my best option. Not sure that it isn't either, but I am sort of a novice when it comes to c++ so I wanted to see if there was a better option.
As always, thanks in advance for any help!
-Matt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The following data structure from the boost library might also be of interest http://www.boost.org/doc/libs/1_36_0/doc/html/boost/unordered_map.html
I'd definitely prefer 'stdext::hash_map<>' over MFC's CMap if you explicity want a hash table.