小さなハッシュ プログラムを作成しようとしていますが、対処方法がわからないエラーがあります。問題は矢印にあり、エラーは次のとおりです。
エラー 1 エラー C2440: 'initializing' : 'std::_String_const_iterator<_Elem,_Traits,_Alloc>' から 'std::_String_iterator<_Elem,_Traits,_Alloc>' に変換できません
私のコード:
#include <iostream>
#include <string>
#include <iterator>
using namespace std;
unsigned long hash(const string& str);
int main()
{
long out;
string word;
word = "about";
out = hash(word) % 255;
cout << out;
system("pause");
return 0;
}
unsigned long djb2(const string& str)
{
unsigned long hash = 5381;
for(string::iterator it=str.begin();it!=str.end();it++) //<~~~~~~~~~~
hash = ((hash << 5) + hash) + *it; /* hash * 33 + character */
return hash;
}