Data Structure to use instead of hash_map
I want to make an array containing three 开发者_Go百科wide character arrays such that one of them is the key.
"LPWCH,LPWCH,LPWCH" was not able to use the greater than/lesser than symbols since it thinks it is a tag
Hash_map only lets me use a pair. wKey and the element associated with it. Is there another data structure that lets me use this?
This set will be updated by different threads almost simultaneously. And thats the reason why I don't want to use a class or another struct to define the remaining two wide character arrays.
You can use LPWCH
as a key and std::pair<LPWCH, LPWCH>
as an element.
Using any of LP-typedefs is not good. You would only be comparing the points, and not strings.
LPWCH
is nothing but a WCHAR*
which can be drilled down to void*
. When you compare two pointers, you are comparing where they are pointing, and not what they are pointing.
You either need to have another comparer attached to your map/hash_map, or use actual string datatype (like std::string
, CString
)
精彩评论