[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1969
  • Last Modified:

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
0
mdw233
Asked:
mdw233
  • 2
1 Solution
 
LordOfPortsCommented:
CMap http://msdn.microsoft.com/en-us/library/s897094z(VS.80).aspx in MFC and hash_map http://msdn.microsoft.com/en-us/library/6x7w9f6z(VS.80).aspx are the most likely equivalents to the Hashtable in C#.
0
 
LordOfPortsCommented:
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
0
 
jkrCommented:
I'd definitely prefer 'stdext::hash_map<>' over MFC's CMap if you explicity want a hash table.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now