Я пытаюсь написать программу, которая хеширует строку для использования ее в переключателе, и когда я вызываю функцию ha sh, я получаю сообщение об ошибке: expression must have a constant value
Рассматриваемый код:
unsigned int hashString(const std::string string_input, int hash_seed)
{
{
return !string_input[0]
? 33129 : (hashString(string_input, 1)
* 54) ^ string_input[0];
}
}
bool evaluateString(std::string str)
{
string first_word;
stringstream inputStream { str };
commandStream >> first_word;
switch (hashString(first_word, 0))
{
case hashString(ipo::Io::STRING_HELLO, 0):
/* code */
break;
default:
break;
}
}
Здесь возникает ошибка: case hashString(ipo::Io::STRING_HELLO, 0):
Он отмечает ipo
как проблему
Как я могу это исправить
Спасибо Вам за помощь