String to Int

This commit is contained in:
Eism 2022-07-12 12:28:42 +03:00
parent 0042a4d192
commit 6034834738

View file

@ -113,6 +113,10 @@ int Val::toInt() const
case Type::Int: return std::get<int>(m_val);
case Type::Int64: return static_cast<int>(toInt64());
case Type::Double: return static_cast<int>(toDouble());
case Type::String: {
std::string str = std::get<std::string>(m_val);
return std::stoi(str);
}
default:
break;
}