Interpreter.cpp:
Код: Выделить всё
using T = variant;
double Interpreter::negateDouble(T value) const {
return visit([](const auto& right) -> double {
if constexpr (is_same_v){
return -right;
}
throw runtime_error("Operand must be numbers.");
}, value);
}
string Interpreter::NormalizeDouble(const string& txt) const {
string strBuilder = "";
bool atDot = false;
bool isAllZeros = false;
bool isDecimal = false;
for(const char& c : txt) {
if(c == '.') {
atDot = true;
}
if(!atDot) {
strBuilder += c;
} else {
if(c == '0') isAllZeros = true;
else if((c >= '0' && c string {
if constexpr (is_same_v){
return val;
} else if constexpr (is_same_v) {
return val ? "true" : "false";
} else if constexpr (is_same_v) {
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79315372/function-keeps-returning-a-monostate-stdvariant-variable-a-type-not-found-wit[/url]