How do I implement a CString hash function for use with std::unordered_map?
I want to declare : std::unordered_map<CString, CString> m_mapMyMap; But when I build I got an error telling me that the standard C++ doesn't provide a hash function for CString, while CString have the (LPCSTR) operator. How do I properly implement a hash function for CString? Based on the MS STL implementation for std::string I created the following methods which can be used for std::unordered_set and std::unordered_map : namespace std { template <> struct hash<CString> { // hash functor for CString size_t operator()(const CString& _Keyval) const { // hash _Keyval to size_t value by