C++中stoi函数显示参数无效该怎样修改
else {
int result;
try {
result=stoi(root->value);
}
catch (std::invalid_argument&) {
// if no conversion could be performed
cout << "Invalid_argument" << endl;
}
catch (std::out_of_range&) {
// if the converted value would fall out of the range of the result type
// or if the underlying function (std::strtol or std::strtoull) sets errno
// to ERANGE.
cout << "Out of range" << endl;
}
catch (...) {
// everything else
cout << "Something else" << endl;
}
return result;
}
stoi()的参数是const string