我不断收到错误,没有构造函数可以采用源类型或构造函数重载解析。
在我的代码开头,我声明了一个无序地图。
unordered_map<char * , a_dictionary * > Mymap;
unsigned char hash[20];
char hex_str[41];
string answer, line;
int yes=0;
cout<<"Press 1 if you would like to use the default file(d8.txt) or press 2 if you want your own file"<<endl;
getline(cin,answer);
stringstream(answer)>> yes;
if(yes == 1 )
{
ifstream myfile("d8.txt");
if (myfile.is_open())
{
while ( myfile.good() )
{
getline (myfile,line);
//cout<<line<<endl;
a_dictionary * dic = new dictionary();
dic->word = line;
const char * c= line.c_str();
sha1::calc(c,line.length(), hash);
sha1::toHexString(hash,hex_str);
Mymap.insert(hex_str, dic); //
这条线就在这里“mymap.insert”不断给我错误 error C2664: 'std::_List_iterator<_Mylist> std::_Hash<_Traits>::insert(std::_List_const_iterator<_Mylist>,_Valty) 即使我通过正确的价值观对吗?
这是调用 toHeXString 的函数
void toHexString(const unsigned char* hash, char* hexstring)
{
const char hexDigits[] = { "0123456789abcdef" };
for (int hashByte = 20; --hashByte >= 0;)
{
hexstring[hashByte << 1] = hexDigits[(hash[hashByte] >> 4) & 0xf];
hexstring[(hashByte << 1) + 1] = hexDigits[hash[hashByte] & 0xf];
}
hexstring[40] = 0;
}