I want to use a data structure that serves as a .Net HashSet, I tried using unordered_set with the default hashing method and user mapping as follows:
struct comparer { bool operator()( const TCHAR* first,const TCHAR* second) const { return _tcscmp((TCHAR*)first,(TCHAR*)second) == 0; } }; typedef unordered_set<const TCHAR*,hash<const TCHAR*>,comparer> HashSet;
the problem is that when I tried to use a HashtSet to search for a specific key (using the method find) that I just added with insert, it returns HashSet::end()!!
find
insert
HashSet::end()
Could you explain what the problem is? I am using VC ++ under VS2010
, hash std::hash, std::hash char* wchar* , , .
hash
std::hash
char*
wchar*
, TCHAR* -, , , , --.
TCHAR*
std::hash string wstring, , , , _UNICODE. " ", TCHAR * string wstring, - , .
string
wstring
_UNICODE
, string wstring -, . unordered_set, , . , , , .
, .
Source: https://habr.com/ru/post/1776891/More articles:Wizard component, library or application for Java SE - javaNewbie: how to use Pantheios magazine API library as a replacement for #ifdef DEBUG? How to determine SEVLEVEL? - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776888/what-are-the-possible-ways-to-using-c-code-in-c&usg=ALkJrhjUul1TDlkoj5mXacEjmYky4jzRkwHow to get the current application path in MFC (VC ++)? - visual-c ++Declare TargetType Type for NestedClass in WPF - .netHow to load CLR into process - .netHow to exclude svn metadata when synchronizing with unison? - synchronizationJQuery getting ul based on matching in child text inside anchor inside with variable cost - jqueryPython, как настроить крючки для отслеживания событий ввода-вывода - pythonShould rail tests test the database or not? - ruby-on-railsAll Articles